Skip to content

Commit

Permalink
Tue Aug 6 08:42:05 MSK 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
hyphop committed Aug 6, 2019
1 parent a32fac3 commit 14fe4ff
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 17 deletions.
5 changes: 4 additions & 1 deletion files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
+ [80_user_env.txt](80_user_env.txt) - user uboot env
+ [boot.dhcp.cmd](boot.dhcp.cmd) - uboot script boot rescue system from DHCP+TFTP
+ [boot.sd.cmd](boot.sd.cmd) - uboot script boot rescue system from SD
+ [boot.sd.make](boot.sd.make) - update boot.sd.scr from boot.sd.cmd source
+ [boot.spi.cmd](boot.spi.cmd) - uboot script boot rescue system from spi flash
+ [boot_detect.cmd](boot_detect.cmd) - #define BOOT_DEVICE_RESERVED 0
+ [boot_detect.cmd](boot_detect.cmd) - boot source detection example
+ [boot_hook.c](boot_hook.c) - #!script
+ [boot_hook.cmd](boot_hook.cmd) - #!script
+ [splash.bmp.gz.make](splash.bmp.gz.make) - smart svg -> bmp rgb565 gz converter
+ [splash.svg](splash.svg) - splash svg logo
5 changes: 4 additions & 1 deletion files/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
+ 80_user_env.txt - user uboot env
+ boot.dhcp.cmd - uboot script boot rescue system from DHCP+TFTP
+ boot.sd.cmd - uboot script boot rescue system from SD
+ boot.sd.make - update boot.sd.scr from boot.sd.cmd source
+ boot.spi.cmd - uboot script boot rescue system from spi flash
+ boot_detect.cmd - #define BOOT_DEVICE_RESERVED 0
+ boot_detect.cmd - boot source detection example
+ boot_hook.c - #!script
+ boot_hook.cmd - #!script
+ splash.bmp.gz.make - smart svg -> bmp rgb565 gz converter
+ splash.svg - splash svg logo
16 changes: 1 addition & 15 deletions files/boot.sd.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,7 @@

LOADER="fatload mmc 0"

BOOT_FROM=

#define BOOT_DEVICE_RESERVED 0
#define BOOT_DEVICE_EMMC 1
#define BOOT_DEVICE_NAND 2
#define BOOT_DEVICE_SPI 3
#define BOOT_DEVICE_SD 4
#define BOOT_DEVICE_USB 5

itest.b *ff800240 == 0xf1 && BOOT_FROM=emmc
itest.b *ff800240 == 0xf3 && BOOT_FROM=spi
itest.b *ff800240 == 0xf4 && BOOT_FROM=sd
itest.b *ff800240 == 0xf5 && BOOT_FROM=usb

echo "**KRESCUE LOAD FROM $BOOT_FROM**"
echo "**KRESCUE LOAD FROM $BOOTED**"

ENV_OFFHEX=0x168000
LOGO_OFFHEX=0x168000
Expand Down
4 changes: 4 additions & 0 deletions files/boot.sd.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
#= update boot.sd.scr from boot.sd.cmd source
mkimage -C none -A arm -T script -d boot.sd.cmd boot.sd.scr

8 changes: 8 additions & 0 deletions files/boot_detect.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# boot source detection example

BOOT_FROM=

#define BOOT_DEVICE_RESERVED 0
Expand All @@ -7,9 +9,15 @@ BOOT_FROM=
#define BOOT_DEVICE_SD 4
#define BOOT_DEVICE_USB 5

md.b ff800240 1

itest.b *ff800240 == 0xf1 && BOOT_FROM=emmc
itest.b *ff800240 == 0xf3 && BOOT_FROM=spi
itest.b *ff800240 == 0xf4 && BOOT_FROM=sd
itest.b *ff800240 == 0xf5 && BOOT_FROM=usb
itest.b *ff800240 == 0xb1 && BOOT_FROM=emmc
itest.b *ff800240 == 0xb3 && BOOT_FROM=spi
itest.b *ff800240 == 0xb4 && BOOT_FROM=sd
itest.b *ff800240 == 0xb5 && BOOT_FROM=usb

echo "**KRESCUE LOAD FROM $BOOT_FROM**"
22 changes: 22 additions & 0 deletions files/boot_hook.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
#!script
# boot_hook for rescue boot if file /rescue/boot.sd.scr will be finded on SD card
# add this into uboot -> board_later_init // run_command_list(THIS_SCRIPT_STRINGS,-1,0);
# plz dont use local vars on this stage
*/
run_command_list("\n\
setenv SCRIPT_ADDR 0x50000000\n\
setenv BOOT_HOOK /rescue/boot.sd.scr\n\
setenv POST_HOOK \"script $SCRIPT_ADDR || autoscr $SCRIPT_ADDR; sleep 1\"\n\
if fatload mmc 0 $SCRIPT_ADDR $BOOT_HOOK; then\n
setenv bootcmd $POST_HOOK\n\
exit 0\n\
fi\n\
if ext4load mmc 0 $SCRIPT_ADDR $BOOT_HOOK; then\n\
setenv bootcmd $POST_HOOK\n\
exit 0\n\
fi\n"
,-1,0);

18 changes: 18 additions & 0 deletions files/boot_hook.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!script

# boot_hook for rescue boot if file /rescue/boot.sd.scr will be finded on SD card
# add this into uboot -> board_later_init // run_command_list(THIS_SCRIPT_STRINGS,-1,0);

# plz dont use local vars on this stage
setenv SCRIPT_ADDR 0x50000000
setenv BOOT_HOOK /rescue/boot.sd.scr
setenv POST_HOOK "script $SCRIPT_ADDR || autoscr $SCRIPT_ADDR; sleep 1"

if fatload mmc 0 $SCRIPT_ADDR $BOOT_HOOK; then
setenv bootcmd $POST_HOOK
exit 0
fi
if ext4load mmc 0 $SCRIPT_ADDR $BOOT_HOOK; then
setenv bootcmd $POST_HOOK
exit 0
fi
2 changes: 2 additions & 0 deletions scripts/prepare_sd_image_rescue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ CMD cp ../share/uI* $D$RESCUE
CMD cp ../share/linux.dtb $D$RESCUE/uboot.dtb
CMD cp ../share/splash.bmp.gz $D$RESCUE
CMD cp ../files/boot.sd.cmd $D$RESCUE
CMD cp ../files/boot.sd.make $D$RESCUE
CMD mkimage -C none -A arm -T script -d $D$RESCUE/boot.sd.cmd $D$RESCUE/boot.sd.scr
CMD cp ../files/80_user_env.txt $D$RESCUE

ls -l1 $D/* | tee $D$RESCUE/files.list
Expand Down

0 comments on commit 14fe4ff

Please sign in to comment.