cd /boot && curl -OL https://raw.githubusercontent.com/cattyhouse/N1-install/master/aml_autoscript.zip
cat <<'EOF' > /boot/aml_autoscript.cmd defenv setenv bootcmd 'run start_autoscript; run storeboot;' setenv start_autoscript 'if mmcinfo; then run start_mmc_autoscript; fi; if usb start; then run start_usb_autoscript; fi; run start_emmc_autoscript' setenv start_emmc_autoscript 'if fatload mmc 1 1020000 emmc_autoscript; then autoscr 1020000; fi;' setenv start_mmc_autoscript 'if fatload mmc 0 1020000 s905_autoscript; then autoscr 1020000; fi;' setenv start_usb_autoscript 'for usbdev in 0 1 2 3; do if fatload usb ${usbdev} 1020000 s905_autoscript; then autoscr 1020000; fi; done' setenv upgrade_step 2 saveenv sleep 1 reboot EOF
s905_autoscript.cmd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cat <<'EOF' > /boot/s905_autoscript.cmd if fatload mmc 0 0x11000000 boot_android; then if test ${ab} = 0; then setenv ab 1; saveenv; exit; else setenv ab 0; saveenv; fi; fi; if fatload usb 0 0x11000000 boot_android; then if test ${ab} = 0; then setenv ab 1; saveenv; exit; else setenv ab 0; saveenv; fi; fi; setenv env_addr 0x10400000 setenv kernel_addr 0x11000000 setenv initrd_addr 0x13000000 setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_mem_addr} setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi' setenv try_boot_start 'if fatload ${devtype} ${devnum} ${kernel_addr} zImage; then if fatload ${devtype} ${devnum} ${initrd_addr} uInitrd; then fatload ${devtype} ${devnum} ${env_addr} uEnv.ini && env import -t ${env_addr} ${filesize} && run addmac; fatload ${devtype} ${devnum} ${dtb_mem_addr} ${dtb_name} && run boot_start; fi; fi;' setenv devtype mmc setenv devnum 0 run try_boot_start setenv devtype usb for devnum in 0 1 2 3 ; do run try_boot_start ; done EOF
emmc_autoscript.cmd
1 2 3 4 5 6 7 8 9
cat <<'EOF' > /boot/emmc_autoscript.cmd setenv env_addr 0x10400000 setenv kernel_addr 0x11000000 setenv initrd_addr 0x13000000 setenv dtb_mem_addr 0x1000000 setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_mem_addr} setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi' if fatload mmc 1 ${kernel_addr} zImage; then if fatload mmc 1 ${initrd_addr} uInitrd; then if fatload mmc 1 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize}; run addmac; fi; if fatload mmc 1 ${dtb_mem_addr} ${dtb_name}; then run boot_start;fi;fi;fi; EOF
生成二进制文件
1 2 3 4
cd /boot mkimage -C none -A arm -T script -d aml_autoscript.cmd aml_autoscript mkimage -C none -A arm -T script -d s905_autoscript.cmd s905_autoscript mkimage -C none -A arm -T script -d emmc_autoscript.cmd emmc_autoscript
同步 aml_autoscript 的内容
1 2 3 4 5
fw_setenv bootcmd 'run start_autoscript; run storeboot;' fw_setenv start_autoscript 'if mmcinfo; then run start_mmc_autoscript; fi; if usb start; then run start_usb_autoscript; fi; run start_emmc_autoscript' fw_setenv start_emmc_autoscript 'if fatload mmc 1 1020000 emmc_autoscript; then autoscr 1020000; fi;' fw_setenv start_mmc_autoscript 'if fatload mmc 0 1020000 s905_autoscript; then autoscr 1020000; fi;' fw_setenv start_usb_autoscript 'for usbdev in 0 1 2 3; do if fatload usb ${usbdev} 1020000 s905_autoscript; then autoscr 1020000; fi; done'