Skip to content

Commit

Permalink
Improve building core and bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
DC-SWAT committed Dec 1, 2022
1 parent ff16be6 commit 0a665fd
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ settings.json
*.cdi
.libs
build/
release/
*DS_CORE.BIN
romdisk.img
exports.c
Expand Down
53 changes: 36 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#

TARGET = DS
TARGET_NAME = DreamShell_v4.0.0_RC5
TARGET_BIN = $(TARGET)_CORE.BIN
TARGET_BIN_CD = 1$(TARGET_BIN)
TRAGET_VERSION = -DVER_MAJOR=4 -DVER_MINOR=0 -DVER_MICRO=0 -DVER_BUILD=0x25 #RC 5
Expand All @@ -24,7 +25,6 @@ include sdk/Makefile.cfg
INC_DIR = ./include
SRC_DIR = ./src
LIB_DIR = ./lib
RES_DIR = ./resources

KOS_LDFLAGS += -L$(LIB_DIR)
KOS_CFLAGS += -I$(INC_DIR) -I$(INC_DIR)/SDL -I$(INC_DIR)/fatfs -I$(INC_DIR)/ntfs \
Expand Down Expand Up @@ -138,27 +138,27 @@ romdisk.o: romdisk.img
$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o

logo: romdisk/logo.kmg.gz
romdisk/logo.kmg.gz: $(RES_DIR)/logo_sq.png
$(KOS_BASE)/utils/kmgenc/kmgenc -v $(RES_DIR)/logo_sq.png
mv $(RES_DIR)/logo_sq.kmg logo.kmg
romdisk/logo.kmg.gz: $(DS_RES)/logo_sq.png
$(KOS_BASE)/utils/kmgenc/kmgenc -v $(DS_RES)/logo_sq.png
mv $(DS_RES)/logo_sq.kmg logo.kmg
gzip -9 logo.kmg
mv logo.kmg.gz romdisk/logo.kmg.gz

make-build: $(DS_BUILD)/lua/startup.lua

$(DS_BUILD)/lua/startup.lua: $(RES_DIR)/lua/startup.lua
$(DS_BUILD)/lua/startup.lua: $(DS_RES)/lua/startup.lua
@echo Creating build directory...
@mkdir -p $(DS_BUILD)
@mkdir -p $(DS_BUILD)/apps
@mkdir -p $(DS_BUILD)/cmds
@mkdir -p $(DS_BUILD)/modules
@mkdir -p $(DS_BUILD)/screenshot
@mkdir -p $(DS_BUILD)/vmu
@cp -R $(RES_DIR)/doc $(DS_BUILD)
@cp -R $(RES_DIR)/firmware $(DS_BUILD)
@cp -R $(RES_DIR)/fonts $(DS_BUILD)
@cp -R $(RES_DIR)/gui $(DS_BUILD)
@cp -R $(RES_DIR)/lua $(DS_BUILD)
@cp -R $(DS_RES)/doc $(DS_BUILD)
@cp -R $(DS_RES)/firmware $(DS_BUILD)
@cp -R $(DS_RES)/fonts $(DS_BUILD)
@cp -R $(DS_RES)/gui $(DS_BUILD)
@cp -R $(DS_RES)/lua $(DS_BUILD)
@mkdir -p $(DS_BUILD)/firmware/aica
@cp ../kernel/arch/dreamcast/sound/arm/stream.drv $(DS_BUILD)/firmware/aica/kos_stream.drv

Expand All @@ -169,11 +169,26 @@ $(LIB_DIR)/libSDL_$(SDL_VER).a:

build: $(TARGET)
@echo Building modules, commands, applications and firmwares...
cd ./modules && make && make install
cd ./commands && make && make install
cd ./applications && make && make install
cd ./firmware/isoldr/loader && make && make install
# cd ../firmware/aica && make && make install
cd $(DS_BASE)/modules && make && make install
cd $(DS_BASE)/commands && make && make install
cd $(DS_BASE)/applications && make && make install
cd $(DS_BASE)/firmware/isoldr/loader && make && make install
cd $(DS_BASE)/firmware/bootloader && make && make install
# cd $(DS_BASE)/firmware/aica && make && make install

release: build cdi
@echo Creating a full release...
@-rm -rf $(DS_BUILD)/.* 2> /dev/null
@-rm -rf $(DS_BASE)/release
@mkdir -p $(DS_BASE)/release/$(TARGET)
@cp -R $(DS_BUILD)/* $(DS_BASE)/release/$(TARGET)
@cp $(TARGET_BIN) $(DS_BASE)/release/$(TARGET)
@cd $(DS_BASE)/firmware/bootloader && make && make release
@mv $(DS_BASE)/firmware/bootloader/*.cdi $(DS_BASE)/release
@mv $(TARGET).cdi $(DS_BASE)/release/$(TARGET_NAME).cdi
@echo Compressing...
@cd $(DS_BASE)/release && zip -q -r $(TARGET_NAME).zip * 2> /dev/null
@echo Complete!

$(TARGET): libs $(TARGET_BIN) make-build

Expand All @@ -200,14 +215,18 @@ $(TARGET).cdi: $(TARGET_BIN_CD) make-build
@-rm -f $(DS_BUILD)/$(TARGET_BIN)
@-rm -f $(DS_BUILD)/$(TARGET_BIN_CD)
@cp $(TARGET_BIN_CD) $(DS_BUILD)/$(TARGET_BIN_CD)
@$(DS_SDK)/bin/mkisofs -V DreamShell -C 0,11702 -G $(RES_DIR)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso $(DS_BUILD)
@-rm -rf $(DS_BUILD)/.* 2> /dev/null
@dd if=/dev/zero of=$(DS_BUILD)/0.0 bs=1024k count=450
@$(DS_SDK)/bin/mkisofs -V DreamShell -C 0,11702 -G $(DS_RES)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso $(DS_BUILD)
@echo Convert ISO to CDI...
@-rm -f $(TARGET).cdi
@$(DS_SDK)/bin/cdi4dc $(TARGET).iso $(TARGET).cdi >/dev/null
@-rm -f $(TARGET).iso
@-rm -f $(DS_BUILD)/$(TARGET_BIN_CD)
@-rm -f $(DS_BUILD)/0.0

# If you have problems with mkisofs try data/data image:
# $(DS_SDK)/bin/mkisofs -V DreamShell -G $(RES_DIR)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso $(DS_BUILD)
# $(DS_SDK)/bin/mkisofs -V DreamShell -G $(DS_RES)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso $(DS_BUILD)
# @$(DS_SDK)/bin/cdi4dc $(TARGET).iso $(TARGET).cdi >/dev/null

nulldc: $(TARGET).cdi
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ make
make build
```

### Release
```console
make release
```

### Modules, applications and commands
```console
cd ./modules && make && make install && cd ../
Expand Down
2 changes: 2 additions & 0 deletions firmware/bootloader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.bin
cd/
20 changes: 13 additions & 7 deletions firmware/bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,26 @@ $(TARGET_CD): $(TARGET).bin
cdi: $(TARGET_CD)
@mkdir -p ./cd
@$(DS_SDK)/bin/scramble $(TARGET).bin $(TARGET_CD)
@$(DS_SDK)/bin/mkisofs -V DreamShell -C 0,11702 -G res/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso ./cd
@$(DS_SDK)/bin/mkisofs -V DreamShell -C 0,11702 -G $(DS_RES)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso ./cd
@echo Convert ISO to CDI...
@-rm -f $(TARGET).cdi
@$(DS_SDK)/bin/cdi4dc $(TARGET).iso $(TARGET).cdi >/dev/null
@-rm -f $(TARGET).iso

# If you have problems with mkisofs try data/data image:
# $(DS_SDK)/bin/mkisofs -V DreamShell -G res/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso ./cd
# $(DS_SDK)/bin/mkisofs -V DreamShell -G $(DS_RES)/IP.BIN -joliet -rock -l -x .DS_Store -o $(TARGET).iso ./cd
# @$(DS_SDK)/bin/cdi4dc $(TARGET).iso $(TARGET).cdi -d >/dev/null

release: all $(TARGET_DUMMY) cdi
rm -f $(TARGET_NAME).elf $(TARGET_NAME).bin $(TARGET_NAME).cdi
mv $(TARGET).elf $(TARGET_NAME).elf
mv $(TARGET).bin $(TARGET_NAME).bin
mv $(TARGET).cdi $(TARGET_NAME).cdi
release: all $(TARGET_DUMMY) cdi install
@rm -f $(TARGET_NAME).bin $(TARGET_NAME).cdi
@cp $(TARGET).bin $(TARGET_NAME).bin
@mv $(TARGET).cdi $(TARGET_NAME).cdi

install: $(TARGET).bin
@$(DS_SDK)/bin/mkbios $(DS_BUILD)/firmware/bios/ds/boot_loader_devkit_nogdrom.bios $(TARGET).bin
@$(DS_SDK)/bin/mkbios $(DS_BUILD)/firmware/bios/ds/boot_loader_devkit.bios $(TARGET).bin
@$(DS_SDK)/bin/mkbios $(DS_BUILD)/firmware/bios/ds/boot_loader_retail_nogdrom.bios $(TARGET).bin
@$(DS_SDK)/bin/mkbios $(DS_BUILD)/firmware/bios/ds/boot_loader_retail.bios $(TARGET).bin

$(TARGET_DUMMY):
@mkdir -p ./cd
Expand Down
Binary file removed firmware/bootloader/res/IP.BIN
Binary file not shown.
9 changes: 5 additions & 4 deletions sdk/Makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

include $(KOS_BASE)/Makefile.rules

DC_LAN_IP = 192.168.1.110
DC_SERIAL_PORT = /dev/ttyUSB0
DC_LAN_IP = 192.168.1.252
DC_SERIAL_PORT = /dev/tty.usbserial-0001
DC_SERIAL_BAUD = 500000

DS_BASE = $(KOS_BASE)/ds
DS_SDK = $(DS_BASE)/sdk
DS_BUILD = $(DS_BASE)/build
DS_SDK = $(DS_BASE)/sdk
DS_BUILD = $(DS_BASE)/build
DS_RES = $(DS_BASE)/resources

KOS_SIZE = $(KOS_CC_BASE)/bin/$(KOS_CC_PREFIX)-size
KOS_CFLAGS += -I$(DS_SDK)/include \
Expand Down

0 comments on commit 0a665fd

Please sign in to comment.