Preface, I am a newbie and am looking for some help with U-Boot. I have a little knowledge of programming. I know the ‘environment variables’ are just global constants that the program ‘U-Boot’ uses to process conditions. I have been reading on http://www.denx.de/ and a few other websites. One site https://www.linuxjournal.com/content/handy-u-boot-trick shows block diagram ‘x-loader – u-boot.bin – interruption – u-boot shell --or-- no interruption – execute bootcmd.
I have a Netgear NAS that does not boot correctly. I know the hardware is fine.
Here is the issue - with usb-serial attachment I am able to connect. If I interrupt the boot process and from the U-Boot command line and I type in ‘boot’, the unit comes up normally and I can access it. If I don’t interrupt the boot it goes into another state and I cannot access.
My question is what is U-Boot doing? What is it setting NAS up for? I have looked at some environment prints from a Buffalo NAS (which usually boots from the 1st harddrive) and compared it to my environment variables to see the differences. Not sure how U-Boot is handling things. I know U-Boot is basically bootstrap software to load up operating systems. If you need full environment printout I can supply.
U-Boot 2013.10-alpine_db-1.49 (Dec 21 2017 - 13:28:18)
Here is excerpts from my environment:
This is from 'ALPINE_DB> fdt print'.
( Per Netgear for 'usb recovery' put usb drive in and press and hold the backup button and power on, and it 'should' load from the usb. Not sure if the backup button is 'gpio33'.)
If I do not interrupt boot process this is some of what comes on console:
If I interrupt the boot process and type in boot at command line, this is what I get:
Also, I noticed in the environment these line:
2nd question - how do the root and bootup and a few other statements come into play? What calls these variables?
3rd question – ‘odmbootseq=run odmbootargs; run odmbootusb; run odmbootfirmware; failure;’ what does ‘failure’ do in u-boot? I cannot find that in command listings, or anywhere on the web.
Thanks in advance.
Mike
=========
moderator edit: please use code tags to post logs and commands
I have a Netgear NAS that does not boot correctly. I know the hardware is fine.
Here is the issue - with usb-serial attachment I am able to connect. If I interrupt the boot process and from the U-Boot command line and I type in ‘boot’, the unit comes up normally and I can access it. If I don’t interrupt the boot it goes into another state and I cannot access.
My question is what is U-Boot doing? What is it setting NAS up for? I have looked at some environment prints from a Buffalo NAS (which usually boots from the 1st harddrive) and compared it to my environment variables to see the differences. Not sure how U-Boot is handling things. I know U-Boot is basically bootstrap software to load up operating systems. If you need full environment printout I can supply.
U-Boot 2013.10-alpine_db-1.49 (Dec 21 2017 - 13:28:18)
Here is excerpts from my environment:
bootcmd=run odmbootseq; odmbootseq=run odmbootargs; run odmbootusb; run odmbootfirmware; failure; odmbootargs=setenv bootargs pci=pcie_bus_perf console=ttyS0,115200 $reasonargs $bootargsextra ; printenv bootargs reasonargs=reason=normal bootargsextra=bdtype=rn204 odmbootusb=usb start;fatload usb 0 $loadaddr NTGR_USBBOOT_INFO.txt;if test $? -eq 0; then run odmbootbackusb;fi; loadaddr=0x08000000 loadaddr_dt=0x07000000 loadaddr_fs=0x8800000 loadaddr_payload=0x08000004 loadaddr_rootfs_chk=0x07000000 nand_pt_addr_al_boot=0x0 nand_pt_addr_fs=0x01000000 nand_pt_addr_kernel=0x00400000 nand_pt_addr_kernel_1=0x00400000 nand_pt_addr_kernel_2=0x00a00000 nand_pt_desc_kernel_1=Test kernel A nand_pt_desc_kernel_2=Test kernel B nand_pt_size_al_boot=0x00100000 nand_pt_size_fs=0x3f000000 nand_pt_size_kernel=0x00c00000 odmbootbackusb=usb start;lcd_print "Loading..."; fatload usb 0 $loadaddr uImage-recovery;if test $? -eq 0; then fatload usb 0 $loadaddr_fs initrd-recovery.gz;if test $? -eq 0; then flash_contents_obj_read DT 0 $loadaddr_dt;run odmboot;else;lcd_print "Failed!";failure;fi;else;lcd_print "Failed!";failure;fi; odmboot=lcd_print "Booting..."; gpio set 33;bootm $loadaddr $loadaddr_fs $loadaddr_dt; test=echo this is a test!
This is from 'ALPINE_DB> fdt print'.
( Per Netgear for 'usb recovery' put usb drive in and press and hold the backup button and power on, and it 'should' load from the usb. Not sure if the backup button is 'gpio33'.)
if_gpio33 { id = "if_gpio"; arg = <0x00000021>; }; button@3 { label = "Backup Button"; linux,code = <0x00000085>; gpios = <0x00000009 0x00000000 0x00000001>; };
If I do not interrupt boot process this is some of what comes on console:
Hit any key to stop autoboot: 0 bootargs=pci=pcie_bus_perf console=ttyS0,115200 reason=normal bdtype=rn204 ## Error: "odmbootusb" not defined NAND read: device 0 offset 0x7000000, size 0x400000 4194304 bytes read: OK NAND read: device 0 offset 0x7400000, size 0xb00000 11534336 bytes read: OK ## Booting kernel from Legacy Image at 08000000 ... Image Name: Linux-3.10.20-al-2.5.2 Created: 2014-11-17 23:30:27 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2978744 Bytes = 2.8 MiB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK ## Loading init Ramdisk from Legacy Image at 08800000 ... Image Name: Created: 2015-01-12 8:29:10 UTC Image Type: ARM Linux RAMDisk Image (lzma compressed) Data Size: 10039368 Bytes = 9.6 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ** Using primary FDT on legacy kernel ## Flattened Device Tree blob at 01b25008 Booting using the fdt blob at 0x1b25008 Loading Kernel Image ... OK Loading Ramdisk to 01190000, end 01b23048 ... OK Using Device Tree in place at 01b25008, end 01b2c1b4 ft_board_setup_clock: unable to set /soc/arch-timer.clock-frequency! Starting kernel ...
If I interrupt the boot process and type in boot at command line, this is what I get:
ALPINE_DB> run odmbootseq bootargs=pci=pcie_bus_perf console=ttyS0,115200 reason=normal bdtype=rn204 (Re)start USB... USB0: Register 8000450 NbrPorts 8 Starting the controller USB XHCI 1.00 scanning bus 0 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found ** Bad device usb 0 ** NAND read: device 0 offset 0x200000, size 0x600000 6291456 bytes read: OK NAND read: device 0 offset 0x800000, size 0x400000 4194304 bytes read: OK gpio: pin 33 (gpio 33) value is 1 ## Booting kernel from Legacy Image at 08000000 ... Image Name: Linux-4.4.184.alpine.1 Created: 2019-09-05 2:32:26 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3437376 Bytes = 3.3 MiB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK ## Loading init Ramdisk from Legacy Image at 08800000 ... Image Name: initramfs Created: 2019-09-18 3:20:11 UTC Image Type: ARM Linux RAMDisk Image (lzma compressed) Data Size: 3423536 Bytes = 3.3 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 07000000 Booting using the fdt blob at 0x7000000 Loading Kernel Image ... OK reserving fdt memory region: addr=0 size=100000 Loading Ramdisk to 017df000, end 01b22d30 ... OK Using Device Tree in place at 07000000, end 07008bd3 Starting kernel ...
Also, I noticed in the environment these line:
bootext4=lcd_print "Booting...";scsi init; ext4load scsi ${ext4dev}:${ext4part} $loadaddr ${ext4dir}${dt_filename};if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr_dt $loadaddr;if test $? -ne 0; then run fail; exit; fi;fi;ext4load scsi ${ext4dev}:${ext4part} $loadaddr ${ext4dir}uImage;if test $? -ne 0; then run fail; exit; fi;fdt addr $loadaddr_dt;bootm $loadaddr - $fdtaddr;run fail; exit bootnand=lcd_print "Booting...";nand set_partition_offset $nand_pt_addr_kernel;nand read $loadaddr $nand_pt_addr_kernel 4;setenvmem filesize $loadaddr;incenv filesize 4;nand read $loadaddr $nand_pt_addr_kernel $filesize;nand set_partition_offset $nand_pt_addr_al_boot;bootm $loadaddr_payload - $fdtaddr;lcd_print Failed!;failue; bootnandmulti=run kernel_select;if test $kernel_selected -ne 0; then run bootnand; fi boottftp=lcd_print "Booting...";tftpboot $loadaddr ${tftpdir}${dt_filename};if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr_dt $loadaddr;if test $? -ne 0; then run fail; exit; fi;fi;tftpboot $loadaddr ${tftpdir}uImage;if test $? -ne 0; then run fail; exit; fi;fdt addr $loadaddr_dt;bootm $loadaddr - $fdtaddr;run fail; exit bootupd=is_nand_boot; if test $? -eq 0; then run bootupdspi; else; run bootupdnand; fi bootupdnand=lcd_print "Updating al-boot" "to NAND"; tftpboot $loadaddr_dt ${tftpdir}${dt_filename};if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;fi;tftpboot $loadaddr ${tftpdir}boot.img; if test $? -ne 0; then run fail; exit; fi;nand set_partition_offset $nand_pt_addr_al_boot;nand erase.spread $nand_pt_addr_al_boot $filesize; nand write $loadaddr $nand_pt_addr_al_boot $filesize; nand erase.spread ${dt_location} 10000; nand write ${loadaddr_dt} ${dt_location} 10000; lcd_print "Done" bootupdnandy=lcd_print "Updating al-boot" "to NAND"; echo >> Use YModem to upload the device tree binary...;loady $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;fi;echo >> Use YModem to upload the boot image binary...;loady $loadaddr;if test $? -ne 0; then run fail; exit; fi;nand set_partition_offset $nand_pt_addr_al_boot;nand erase.spread $nand_pt_addr_al_boot $filesize; nand write $loadaddr $nand_pt_addr_al_boot $filesize; nand erase.spread ${dt_location} 10000; nand write ${loadaddr_dt} ${dt_location} 10000;lcd_print "Done" bootupdspi=lcd_print "Updating al-boot" "to SPI"; tftpboot $loadaddr_dt ${tftpdir}${dt_filename};if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;fi;setenv filesize_dt $filesize;tftpboot ${loadaddr} ${tftpdir}boot.img; if test $? -ne 0; then run fail; exit; fi;sf probe; sf erase 0 +${filesize}; sf write ${loadaddr} 0 ${filesize}; sf erase ${dt_location} +${filesize_dt}; sf write ${loadaddr_dt} ${dt_location} ${filesize_dt}; echo bootupd done;echo Notice: Changes in default environment variables will only take effect once the;echo environment variables are deleted from flash using the 'delenv' script;lcd_print "Done" bootupdspiy=lcd_print "Updating al-boot" "to SPI"; echo >> Use YModem to upload the device tree binary...;loady $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;if test ${dt_is_from_toc} != 1; then; else flash_contents_obj_read_mem $loadaddr $loadaddr_dt;if test $? -ne 0; then run fail; exit; fi;fi;setenv filesize_dt $filesize;echo >> Use YModem to upload the boot image binary...;loady ${loadaddr};if test $? -ne 0; then run fail; exit; fi;sf probe; sf erase 0 +${filesize}; sf write ${loadaddr} 0 ${filesize}; sf erase ${dt_location} +${filesize_dt}; sf write ${loadaddr_dt} ${dt_location} ${filesize_dt};echo bootupd done;echo Notice: Changes in default environment variables will only take effect once the;echo environment variables are deleted from flash using the 'delenv' script;lcd_print "Done" bootupdy=is_nand_boot; if test $? -eq 0; then run bootupdspiy;else; run bootupdnandy; fi rootargshd=setenv rootargs root=${hdroot} rw rootargsnand=setenv rootargs root=ubi0:root rootfstype=ubifs ubi.mtd=3 rootargsnfs=setenv rootargs root=/dev/nfs rw nfsroot=${serverip}:${nfsrootdir},tcp,nolock rw ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${board_name}:eth1:none rootfsupd=lcd_print "Updating rootfs...";tftpboot $loadaddr_rootfs_chk ${tftpdir}rootfs.ubi.md5;if test $? -ne 0; then run fail; exit; fi;tftpboot $loadaddr ${tftpdir}rootfs.ubi;if test $? -ne 0; then run fail; exit; fi;md5sum -v $loadaddr $filesize *$loadaddr_rootfs_chk;if test $? -ne 0; then run fail; exit; fi;nand set_partition_offset $nand_pt_addr_fs;nand erase.spread $nand_pt_addr_fs $nand_pt_size_fs;nand write $loadaddr $nand_pt_addr_fs $filesize;nand set_partition_offset $nand_pt_addr_al_boot;echo rootfsupd done;lcd_print "Done"
2nd question - how do the root and bootup and a few other statements come into play? What calls these variables?
3rd question – ‘odmbootseq=run odmbootargs; run odmbootusb; run odmbootfirmware; failure;’ what does ‘failure’ do in u-boot? I cannot find that in command listings, or anywhere on the web.
Thanks in advance.
Mike
=========
moderator edit: please use code tags to post logs and commands