TEXT 39
Configure-uboot Guest on 10th February 2021 12:49:01 AM
  1. #!/bin/bash
  2. set -e
  3. UBOOT_ENV_SIZE=262144
  4.  
  5. cat > uboot_menu.in <<EOF
  6. bootcmd=
  7.   setenv bootargs
  8.     \${bootargs_base} \${mtdparts}
  9.     rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5 panic=10;
  10.   mmcinit;
  11.   ext2load mmc 1 0x32000000 \${sd_image_name};
  12.   bootm 0x32000000
  13.  
  14. menu_1=
  15.   Boot from Flash:
  16.   setenv bootargs
  17.     \${bootargs_base} \${mtdparts};
  18.   nand read.e 0x32000000 kernel 0x200000;
  19.   bootm 0x32000000
  20.  
  21. menu_2=
  22.   Reboot:
  23.   reset
  24.  
  25. menu_3=
  26.   Power off:
  27.   neo1973 power-off
  28.  
  29. menu_4=
  30.   Set console to USB:
  31.   setenv stdin usbtty;
  32.   setenv stdout usbtty;
  33.   setenv stderr usbtty
  34.  
  35. menu_5=
  36.   Set console to serial:
  37.   setenv stdin serial;
  38.   setenv stdout serial;
  39.   setenv stderr serial
  40.  
  41. menu_6=
  42.   SD/uImage2.bin:
  43.   setenv bootargs
  44.     \${bootargs_base} \${mtdparts}
  45.     rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5 panic=10;
  46.   mmcinit;
  47.   ext2load mmc 1 0x32000000 uImage2.bin;
  48.   bootm 0x32000000
  49.  
  50. menu_7=
  51.   SD/uImage3.bin:
  52.   setenv bootargs
  53.     \${bootargs_base} \${mtdparts}
  54.     rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5 panic=10;
  55.   mmcinit;
  56.   ext2load mmc 1 0x32000000 uImage3.bin;
  57.   bootm 0x32000000
  58.  
  59. menu_8=
  60. EOF
  61.  
  62. echo " * Checking for a sane MTD configuration"
  63. if ! fgrep mtd2 < /proc/mtd |fgrep -q "u-boot_env"; then
  64.     echo "E: U-Boot environment not found at expected location in mtd2"
  65.     exit 1
  66. fi
  67.  
  68. echo " * Dumping current U-Boot environment"
  69. nanddump /dev/mtd2 -o -b -f env.orig
  70. if [ ! $(wc -c env.orig | awk '{print $1}') -eq $UBOOT_ENV_SIZE ]; then
  71.     echo "Environment did not have the expected size of $UBOOT_ENV_SIZE"
  72.     exit 1
  73. fi
  74. echo " * Merging Debian menu entries into U-Boot environment (can take up to 70s)"
  75. uboot-envedit -c -i env.orig -f uboot_menu.in -o env.new
  76. if [ ! $(wc -c env.new | awk '{print $1}') -eq $UBOOT_ENV_SIZE ]; then
  77.     echo "Newly created environment did not have the expected size of $UBOOT_ENV_SIZE"
  78.     exit 1
  79. fi
  80. echo " * Writing back U-Boot environment"
  81. flash_eraseall /dev/mtd2
  82. nandwrite /dev/mtd2 env.new

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.