mirror of
https://github.com/elliotnunn/NetBoot.git
synced 2024-12-21 10:30:03 +00:00
Create a bootstrap floppy
The floppy enables network boot in PRAM. This allows us to remove most of the ROM patches.
This commit is contained in:
parent
c5a4b9e0eb
commit
c6731715db
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
*.app
|
||||
edit.rom
|
||||
.DS_Store
|
||||
BootstrapFloppy/System.rdump
|
||||
Bootstrap.bin
|
||||
BootstrapFloppy.dsk
|
||||
|
99
Bootstrap.a
Normal file
99
Bootstrap.a
Normal file
@ -0,0 +1,99 @@
|
||||
; boot 1 resource
|
||||
; assemble with vasmm68k_mot
|
||||
|
||||
dc.b "LK"
|
||||
bra.w Code
|
||||
dc.b "D" ; executable on all machines
|
||||
dc.b $18 ; version number, unsure if important
|
||||
dc.w 0 ; some flag thing
|
||||
|
||||
|
||||
dc.b 6, 'System '
|
||||
dc.b 6, 'Finder '
|
||||
dc.b 7, 'MacsBug '
|
||||
dc.b 12, 'Disassembler '
|
||||
dc.b 13, 'StartUpScreen '
|
||||
dc.b 6, 'Finder '
|
||||
dc.b 9, 'Clipboard '
|
||||
|
||||
NumFCBs dc.w 10 ; number of FCBs to allocate at boot
|
||||
NumEvents dc.w 20 ; number of event queue elements
|
||||
|
||||
SystemHeapSize128K dc.l $4300 ; size of system heap for 128K system (never used)
|
||||
SystemHeapSize256K dc.l $8000 ; size of system heap for 256K system (never used)
|
||||
SystemHeapSize dc.l $20000 ; size of system heap (used for pre-7.0)
|
||||
|
||||
|
||||
; Okay, now we can ignore all of that crap and take control of the machine!
|
||||
|
||||
Code
|
||||
|
||||
|
||||
|
||||
lea bootVars,a0
|
||||
lea pRamTable,a1
|
||||
pramLoop
|
||||
move.l (a1)+,d0
|
||||
beq.s pramDone
|
||||
move.l d0,d2 ; Save the len/offset arg for later
|
||||
dc.w $A052 ; _WriteXPRam
|
||||
swap d2 ; Get count from upper byte
|
||||
add.w d2,a0 ; and add it to bootVars
|
||||
bra.s pramLoop
|
||||
pramDone
|
||||
|
||||
|
||||
|
||||
; all right, now reboot the machine
|
||||
move.l $2AE,a0 ; ROMBase
|
||||
cmp.b #0,8(A0)
|
||||
beq.s rebootPlus
|
||||
cmp.b #1,8(A0)
|
||||
beq.s rebootII
|
||||
cmp.b #2,8(A0)
|
||||
beq.s rebootSE
|
||||
cmp.b #3,8(A0)
|
||||
beq.s rebootPortable
|
||||
cmp.b #6,8(A0)
|
||||
beq.s rebootIIci
|
||||
|
||||
; try our luck ... maybe it's a SuperMario?
|
||||
move.w #1,-(sp) ; sdRestart
|
||||
dc.w $A895 ; _ShutDown
|
||||
|
||||
rebootPlus jmp $B82(a0)
|
||||
rebootII jmp $11AE(a0)
|
||||
rebootSE jmp $A52(a0)
|
||||
rebootPortable jmp $336E(a0)
|
||||
rebootIIci jmp $203E(a0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bootVars
|
||||
; bootVars
|
||||
dc.b 1 ; osType preferred os to boot from
|
||||
dc.b 1 ; protocol preferred protocol to boot from = NBP
|
||||
dc.b 0 ; errors last error in network booting
|
||||
dc.b $80 ; flags flags for: never net boot, boot first, etc.
|
||||
; bootVars ATPRAMrec
|
||||
dc.b 0 ; nbpVars address of last server that we booted off of
|
||||
dc.b 0 ; timeout seconds to wait for bootserver response
|
||||
dcb.l 4, "PWD " ; signature image signature
|
||||
dcb.b 32 ; userName an array of char, no length byte
|
||||
dcb.b 8 ; password ditto
|
||||
dc.w $8888 ; serverNum the server number
|
||||
dcb.b 8 ; padding to 68b
|
||||
|
||||
|
||||
pRamTable
|
||||
dc.l $00040004
|
||||
dc.l $000300AB
|
||||
dc.l $000100BC
|
||||
dc.l $00200020
|
||||
dc.l $0020008B
|
||||
dc.l $00000000
|
||||
|
||||
|
||||
align 10 ; fill up the boot blocks
|
0
BootstrapFloppy/Finder
Normal file
0
BootstrapFloppy/Finder
Normal file
1
BootstrapFloppy/Finder.idump
Normal file
1
BootstrapFloppy/Finder.idump
Normal file
@ -0,0 +1 @@
|
||||
FNDRMACS
|
0
BootstrapFloppy/System
Normal file
0
BootstrapFloppy/System
Normal file
1
BootstrapFloppy/System.idump
Normal file
1
BootstrapFloppy/System.idump
Normal file
@ -0,0 +1 @@
|
||||
ZSYSMACS
|
14
Makefile
14
Makefile
@ -19,3 +19,17 @@ image: systools607.dsk.a Makefile
|
||||
|
||||
systools607.dsk.a: systools607.dsk
|
||||
python3 -c 'for b in open("systools607.dsk","rb").read(): print(" dc.b $$%02X" % b)' >systools607.dsk.a
|
||||
|
||||
|
||||
Bootstrap.bin: Bootstrap.a
|
||||
vasm-1/vasmm68k_mot -quiet -Fbin -pic -o $@ $<
|
||||
|
||||
|
||||
BootstrapFloppy/System.rdump: Bootstrap.bin
|
||||
rfx cp $< $@//boot/1
|
||||
|
||||
BootstrapFloppy.dsk: BootstrapFloppy/System.rdump
|
||||
MakeHFS -n 'NetBoot Enabler' -i BootstrapFloppy -s 1440k -d now $@
|
||||
|
||||
testflop: BootstrapFloppy.dsk
|
||||
Mini\ vMac\ Classic.app/Co*/Ma*/* xo.rom $<
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
|
||||
|
||||
./NetBoot.py & cp xo.rom edit.rom && ./xo-rom-enable-netboot.py edit.rom && Mini\ vMac\ Classic.app/Contents/MacOS/minivmac edit.rom && kill %1
|
||||
make BootstrapFloppy.dsk
|
||||
|
||||
./NetBoot.py & cp xo.rom edit.rom && ./xo-rom-enable-netboot.py edit.rom && Mini\ vMac\ Classic.app/Contents/MacOS/minivmac edit.rom BootstrapFloppy.dsk && kill %1
|
||||
|
@ -24,50 +24,6 @@ def write_asm(f, asm):
|
||||
|
||||
|
||||
with open(sys.argv[1], 'r+b') as f:
|
||||
# Skip the initial PRAM check in forXO.a:InstallNetBoot
|
||||
f.seek(0x1d928)
|
||||
while f.tell() < 0x1D982:
|
||||
f.write(b'Nq') # nop
|
||||
|
||||
# Find a safe place to store our overridden NetBoot config struct
|
||||
# (Which would otherwise be cobbled from various parts of PRAM)
|
||||
garbage_location = 0x67046 # The MacsBug copyright string in the ROM Disk
|
||||
|
||||
# Make out own structure, as adapted from NetBoot.h
|
||||
the_netboot_structure = struct.pack('>BBBB BB 16s 32s 8s H', # Note that "int"s are 4 bytes, somehow!
|
||||
# First 4 bytes at PRAM+4
|
||||
1, # char osType; /* preferred os to boot from */
|
||||
1, # char protocol; /* preferred protocol to boot from */
|
||||
0, # char errors; /* last error in network booting */
|
||||
0x80, # char flags; /* flags for: never net boot, boot first, etc. */
|
||||
|
||||
# Now, the AppleTalk-protocol-specific part
|
||||
0, # unsigned char nbpVars; /* address of last server that we booted off of */
|
||||
0, # unsigned char timeout; /* seconds to wait for bootserver response */
|
||||
b'PWD PWD PWD PWD ', # unsigned int signature[4]; /* image signature */ Elliot notes: zeroes match anything!
|
||||
b'Elliot', # char userName[31]; /* an array of char, no length byte */
|
||||
b'volapuk', # char password[8]; /* '' */
|
||||
0xBABE, # short serverNum; /* the server number */
|
||||
).ljust(72, b'\0')
|
||||
|
||||
# the_netboot_structure = bytearray(the_netboot_structure)
|
||||
# for i, j in enumerate(range(54, len(the_netboot_structure))):
|
||||
# the_netboot_structure[j] = i
|
||||
|
||||
# This is the guts of the NetBoot ReadPRAM procedure
|
||||
f.seek(0x1DF08)
|
||||
write_asm(f, f'''
|
||||
move.l a0,a1
|
||||
move.l 0x2ae,a0 ; RomBase
|
||||
add.l #{hex(garbage_location)},a0
|
||||
move.l #{hex(len(the_netboot_structure))},d0
|
||||
.2byte 0xA02E ; BlockMove
|
||||
rts
|
||||
''')
|
||||
|
||||
f.seek(garbage_location)
|
||||
f.write(the_netboot_structure)
|
||||
|
||||
# I have implemented Snefru, so this is no longer needed:
|
||||
# Do the dodgy... cancel signature validation!
|
||||
# f.seek(0x21A84)
|
||||
|
Loading…
Reference in New Issue
Block a user