2016-01-17 | Paul Boddie | raw files shortlog changelog graph | Changed the stage 2 base address for usbboot compatibility. Added various options to the USB Boot script for demonstration purposes. | stage2-non-pic |
boot_usb (file) stage2/Makefile (file) stage2/stage2.ld (file) |
1.1 --- a/boot_usb Sun Jan 17 18:49:42 2016 +0100 1.2 +++ b/boot_usb Sun Jan 17 18:50:48 2016 +0100 1.3 @@ -1,3 +1,31 @@ 1.4 #!/bin/sh 1.5 1.6 -xbboot -u 0x80010000 stage2/stage2.bin 1.7 +# To use the installed stage1 payload... 1.8 + 1.9 +if [ "$1" = '--default1' ]; then 1.10 + if xbboot -u 0x81c00000 stage2/stage2.bin ; then 1.11 + exit 0 1.12 + else 1.13 + exit 1 1.14 + fi 1.15 + 1.16 +# To use usbboot, which is less elegant but sometimes more reliable... 1.17 + 1.18 +elif [ "$1" = '--usbboot' ]; then 1.19 + if usbboot -c 'boot' -1 stage1/stage1.bin -2 stage2/stage2.bin ; then 1.20 + exit 0 1.21 + else 1.22 + exit 1 1.23 + fi 1.24 +fi 1.25 + 1.26 +# Otherwise, use the generated payloads with xbboot. 1.27 + 1.28 +xbboot set_addr 0x80002000 1.29 +xbboot bulk_write stage1/stage1.bin 1.30 +xbboot start1 0x80002000 1.31 +xbboot get_info 1.32 +xbboot set_addr 0x81c00000 1.33 +xbboot bulk_write stage2/stage2.bin 1.34 +xbboot flush_cache 1.35 +xbboot start2 0x81c00000
2.1 --- a/stage2/Makefile Sun Jan 17 18:49:42 2016 +0100 2.2 +++ b/stage2/Makefile Sun Jan 17 18:50:48 2016 +0100 2.3 @@ -76,7 +76,7 @@ 2.4 echo "Nothing else to clean." 2.5 2.6 $(UIMAGE): $(PAYLOAD) 2.7 - $(MKIMAGE) -A mips -O linux -T kernel -C none -a 0x80010000 -e 0x80010000 -n NanoPayload -d $(PAYLOAD) $(UIMAGE) 2.8 + $(MKIMAGE) -A mips -O linux -T kernel -C none -a 0x81c00000 -e 0x81c00000 -n NanoPayload -d $(PAYLOAD) $(UIMAGE) 2.9 2.10 $(PAYLOAD): $(TARGET) 2.11 $(OBJCOPY) -O binary $(@:.bin=.elf) $@+