docker refactor

This commit is contained in:
Elliot Nunn 2016-10-20 22:38:42 +08:00
parent 6262c52773
commit 786281db31
6 changed files with 1509 additions and 39803 deletions

View File

@ -1,17 +1,56 @@
export PATH := /usr/cross/powerpc-eabi/bin:$(HOME)/mac-project/toolboxtoolbox:$(PATH)
# mount our current dir as /work in the container, and cd /work
# --rm means don't keep this container after command is done
# next arg should be the image to use (e.g. elliotnunn/toolboxtools)
# then the next one should be the command to run
DOCKER=docker run --volume="$$PWD":/work --workdir=/work --rm
tbxi.hqx: tbxi-data tbxi-rsrc
binhexmake --data=tbxi-data --rsrc=tbxi-rsrc --type=tbxi --creator=chrp --name='Mac OS ROM' tbxi.hqx
# If there is a disassembled kernel (possibly edited) then use it. If not, use the stock kernel.
ifeq ($(wildcard kernel-disasm.s),)
KERNEL=kernel-stock
else
KERNEL=kernel-built
endif
tbxi-data tbxi-rsrc: boot rsrc-template datafork-pefs
tbximake tbxi-data tbxi-rsrc boot rsrc-template datafork-pefs/NQDResidentCursor datafork-pefs/ProcessMgrLib
.PHONY: test-boot.img test clean
boot: chrp-boot-script trampoline.elf prcl
bootmake --boot-script=chrp-boot-script --trampoline=trampoline.elf --parcels=prcl boot
Mac\ OS\ ROM.hqx: tbxi-data tbxi-rsrc
$(DOCKER) elliotnunn/toolboxtools binhexmake --data=tbxi-data --rsrc=tbxi-rsrc --type=tbxi --creator=chrp --name='Mac OS ROM' 'Mac OS ROM.hqx'
prcl: prcl-pefs rom
tbxi-data tbxi-rsrc: base-tbxi rsrc-template datafork-pefs
$(DOCKER) elliotnunn/toolboxtools tbximake tbxi-data tbxi-rsrc base-tbxi rsrc-template datafork-pefs/NQDResidentCursor datafork-pefs/ProcessMgrLib
base-tbxi: boot-script trampoline.elf prcl
$(DOCKER) elliotnunn/toolboxtools bootmake --boot-script=boot-script --trampoline=trampoline.elf --parcels=prcl base-tbxi
PowerROM: PowerROM-nokern $(KERNEL)
cp PowerROM-nokern "$@"
dd if=$(KERNEL) of="$@" conv=notrunc seek=3211264 bs=1
kernel-built: kernel-built.o
$(DOCKER) elliotnunn/powerpc-binutils objcopy -O binary -j .text "$<" "$@"
# Don't declare kernel-disasm.s as a dep because we never want to remake it!
kernel-built.o:
$(DOCKER) elliotnunn/powerpc-binutils as -many -mregnames --nops=2 -o "$@" kernel-disasm.s
kernel-disasm.s: kernel-stock
$(DOCKER) elliotnunn/powerpc-disasm python kernel-disasm-script.py --disasm "$@" "$<"
test-boot.img: Mac\ OS\ ROM.hqx
rsync test-template.img "$@"
HOME=$$PWD hmount "$@"
HOME=$$PWD hcopy -b "$<" 'QEMU HD:System Folder:'
rm .hcwd
test: test-boot.img
qemu-system-ppc -M mac99 -m 512 -prom-env 'auto-boot?=true' -g 800x600x32 -drive format=raw,media=disk,file="$<"
clean:
rm -f base-tbxi 'Mac OS ROM.hqx' kernel-built kernel-built.o prcl PowerROM tbxi-data tbxi-rsrc test-boot.img
prcl: prcl-pefs PowerROM
@echo making parcels... takes a while
@prclmake prcl \
@$(DOCKER) elliotnunn/toolboxtools prclmake prcl \
--prcl -f=00020000 -t=node -n='CodePrepare Node Parcel' -c='' \
--bin -f=00000000 -t=cstr -n=name --data AAPL,CodePrepare \
--bin -f=00000000 -t=csta -n=AAPL,prepare_order --data Placeholder \
@ -27,7 +66,7 @@ prcl: prcl-pefs rom
--bin -f=00010094 -t=shlb -n=StartLib -l --src=prcl-pefs/CodeRegister_StartLib \
\
--prcl -f=00000000 -t='rom ' -n='Mac OS ROM Parcel' -c='' \
--bin -f=00000005 -t='rom ' -n='' -l --src=rom \
--bin -f=00000005 -t='rom ' -n='' -l --src=PowerROM \
\
--prcl -f=00000000 -t=psum -n='Property Checksum' -c='' \
--bin -f=00000000 -t=csta -n='' --data name model compatible device_type reg assigned-addresses slot-names vendor-id device-id class-code devsel-speed fast-back-to-back bootpath mac-address \
@ -133,32 +172,3 @@ prcl: prcl-pefs rom
--bin -f=00000000 -t=ndrv -n=pef,AAPL,MacOS,PowerPC,register -l --src=prcl-pefs/PowerMgrPlugin_PMU99 \
--bin -f=00000002 -t=cstr -n=code,AAPL,MacOS,name --data PowerMgrPlugin \
--bin -f=00010096 -t=nlib -n=PMULib -l --src=prcl-pefs/PMULib
rom: rom-nokern kern
cp rom-nokern rom; \
dd if=kern of=rom conv=notrunc seek=3211264 bs=1
kern: kern.o
powerpc-eabi-objcopy -O binary -j .text kern.o kern
kern.o: kern.asm
powerpc-eabi-as -many -mregnames -o kern.o kern.asm
test-boot.img: FORCE tbxi.hqx
rsync test-template.img test-boot.img
HOME=$$PWD hmount test-boot.img
HOME=$$PWD hcopy -b tbxi.hqx 'QEMU HD:System Folder:'
rm .hcwd
test: test-boot.img
qemu-system-ppc -M mac99 -m 512 -prom-env 'auto-boot?=true' -g 800x600x32 -drive format=raw,media=disk,file=test-boot.img
upload: tbxi.hqx
printf "open 192.168.0.6\nuser anonymous cdg5\ndelete tbxi.hqx\nput tbxi.hqx\ndelete \"System Folder\"/tbxi.hqx\nrename tbxi.hqx \"System Folder\"/tbxi.hqx\nclose\nexit\n" | ftp -n
clean:
rm -f boot tbxi.hqx kern kern.o prcl rom tbxi-data tbxi-rsrc test-boot.img
FORCE:

39654
kern.asm

File diff suppressed because it is too large Load Diff

1350
kernel-disasm-script.py Executable file

File diff suppressed because it is too large Load Diff

BIN
kernel-stock Normal file

Binary file not shown.