creating partitions and updating U-Boot from U-Boot bootscript / autoscript does not work due to interactive inputs required

U-Boot autoscript feature is described in /usr/local/DigiEL-5.2/docs/Software/U-Boot_Reference_Manual.pdf Revision H in section 6. However when using this for production, it does not allow to run "flpart" or "update uboot" from this, as those commands are interactively using the serial port. The workaround is to update the uboot with non-interactive commands and to create the needed Linux partitions with "intnvram" also in non-interactive mode. Drawback: the bootscript is then very dependent on the module and the size of flash and partitions.
First of all determine which partition start address and size you need. E.g. if you configured a module interactively with "flpart" reset linux quit and save, you can check the addresses to pass to the intnvram with intnvram printall.
create a txt file with an empty last row ending with 0x0a 0x0a (no DOS CR/LF in it):
tftp $(loadaddr) $(uimg)
example for CC9P9215 example for Connec ME 9210
protect off 50000000 +40000 protect off 50000000 +30000
erase 50000000 +40000 erase 50000000 +30000
cp.b $(loadaddr) 50000000 $(filesize)
example for CC9P9215 example for Connec ME 9210
intnvram set partition add name=Kernel start=80000 size=180000 type=Linux-Kernel intnvram set partition add name=Kernel start=50000 size=140000 type=Linux-Kernel
intnvram set partition add name=RootFS start=200000 size=E00000 type=Filesystem flag_fs_type=JFFS2 flag_fs_root=yes intnvram set partition add name=RootFS start=190000 size=180000 type=Filesystem flag_fs_type=SQUASHFS flag_fs_root=yes
intnvram save
update linux
update rootfs
setenv loadbootsc no
setenv bootcmd dboot linux flash
      <- this is an empty last line!!

save this as: cc9p9215-custom-commands.txt Compile this into a bootscript image file with the command:
# /usr/local/DigiEL-5.2/usr/bin/mkimage -A arm -O linux -T script -C none -a 200000 -e 200000 -n cc9p9215js-bootscript -d cc9p9215-custom-commands.txt cc9p9215js-bootscript
# cp cc9p9215js-bootscript /tftpboot
# cp myU-Boot myLinux myRootfs /tftpboot

Next time you boot a module with autoscript enabled, this bootscript should be executed. For modules with only (4MB or) 8MB Flash, the parition start and size given in the script have to be modified.
Note: modules coming from Digi might have some partitions pre-configured, so you might need to use the command:
intnvram set partition select=2 del to delete any unwanted partitions. However if this command fails, due to the partition is not there, the autoscript/bootscript will stop execution!
Note 2: don't use intnvram reset as it will clear the MAC address to default: 00:40:9D:FF:FF:FA. You can fix it later with: intnvram set module ethaddr1=00:40:9D:xx:yy:zz  but this means a different (or dynamic) script for each module.
Note 3: Digi does not guarantee to deliver module having JTAG pins with any pre-programmed U-Boot. Also the pre-programmed U-Boot version if available might change and is not intended for usage in field at all. Also if you receive corrupted modules back from field, where your U-Boot does not boot anymore, you need to have a fall back strategy to program those via JTAG anyway. see: How do I program my Linux images onto a Digi embedded module?
Last updated: Jun 12, 2019

Filed Under


Recently Viewed

No recently viewed articles

Did you find this article helpful?