zhemao / zhemao.github.com

Github pages page
http://zhemao.github.com
Other
4 stars 1 forks source link

Error in booting : Unknown command 'bootz' - try 'help' #24

Closed karthikbhat77 closed 9 years ago

karthikbhat77 commented 9 years ago

Hi Howard,

I'm trying to install linux on SoCkit and I'm following your tutorial. I got through all the steps and wrote the images on to the SD card. But when I try to boot I get an error saying "Unknown command 'bootz' - try help".

Could you please help me with this.

I'm using Ubuntu 14.04 on Virtualbox to do the whole process - if this helps. The error is shown below:

U-Boot 2012.10 (Feb 28 2013 - 21:33:41)

CPU : Altera SOCFPGA Platform BOARD : Altera SOCFPGA Cyclone 5 Board DRAM: 1 GiB MMC: DESIGNWARE SD/MMC: 0 In: serial Out: serial Err: serial Net: mii0 Warning: failed to set MAC address

Hit any key to stop autoboot: 0 reading u-boot.scr

\ Unable to read "u-boot.scr" from mmc 0:1 ** Optional boot script not found. Continuing to boot normally reading zImage

3186248 bytes read reading socfpga.dtb

16289 bytes read fpgaintf ffd08028: 00000000 .... fpga2sdram ffc25080: 00000000 .... axibridge ffd0501c: 00000000 .... Unknown command 'bootz' - try 'help' SOCFPGA_CYCLONE5 #

zhemao commented 9 years ago

Strange, that sequence of commands is very different from my u-boot commands. Could you do the following to get some more info?

karthikbhat77 commented 9 years ago

So, "bootz" is supposed to be the command to boot zImage. Yes, I checked the environment variables and its referring to 'bootz'. Here's the output....

SOCFPGA_CYCLONE5 # printenv ECC_SDRAM=0 ECC_SDRAM_DBE=0 ECC_SDRAM_SBE=0 axibridge=ffd0501c axibridge_handoff=0x00000000 baudrate=115200 bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait bootcmd=run callscript;run mmcload;run bridge_enable_handoff;run mmcboot bootdelay=5 bootimage=zImage bootimagesize=0x600000 bridge_disable=mw $fpgaintf 0; mw $fpga2sdram 0; mw $axibridge 0; mw $l3remap 0x1; echo fpgaintf; md $fpgaintf 1; echo fpga2sdram; md $fpga2sdram 1; echo axibridge; md $axibridge 1 bridge_enable_handoff=mw $fpgaintf ${fpgaintf_handoff}; mw $fpga2sdram ${fpga2sdram_handoff}; mw $axibridge ${axibridge_handoff}; mw $l3remap ${l3remap_handoff}; echo fpgaintf; md $fpgaintf 1; echo fpga2sdram; md $fpga2sdram 1; echo axibridge; md $axibridge 1 callscript=if fatload mmc 0:1 $fpgadata $scriptfile;then source $fpgadata; else echo Optional boot script not found. Continuing to boot normally; fi; ethact=mii0 fdtaddr=0x00000100 fdtimage=socfpga.dtb fdtimagesize=0x5000 filesize=3FA1 fpga=0 fpga2sdram=ffc25080 fpga2sdram_handoff=0x00000000 fpgadata=0x2000000 fpgadatasize=0x700000 fpgaintf=ffd08028 fpgaintf_handoff=0x00000000 l3remap=ff800000 l3remap_handoff=0x00000019 loadaddr=0x8000 micrel-ksz9021-clk-skew=0xf0f0 micrel-ksz9021-data-skew=0x0 mmcboot=setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait;bootz ${loadaddr} - ${fdtaddr} mmcload=mmc rescan;${mmcloadcmd} mmc 0:${mmcloadpart} ${loadaddr} ${bootimage};${mmcloadcmd} mmc 0:${mmcloadpart} ${fdtaddr} ${fdtimage} mmcloadcmd=fatload mmcloadpart=1 mmcroot=/dev/mmcblk0p2 netboot=dhcp ${bootimage} ; tftp ${fdtaddr} ${fdtimage} ; run ramboot qspiboot=setenv bootargs console=ttyS0,115200 root=${qspiroot} rw rootfstype=${qspirootfstype};bootz ${loadaddr} - ${fdtaddr} qspibootimageaddr=0xa0000 qspifdtaddr=0x50000 qspiload=sf probe ${qspiloadcs};sf read ${loadaddr} ${qspibootimageaddr} ${bootimagesize};sf read ${fdtaddr} ${qspifdtaddr} ${fdtimagesize}; qspiloadcs=0 qspiroot=/dev/mtdblock1 qspirootfstype=jffs2 ramboot=setenv bootargs console=ttyS0,115200;bootz ${loadaddr} - ${fdtaddr} scriptfile=u-boot.scr stderr=serial stdin=serial stdout=serial verify=n

I tried to boot using bootm command but it gives an error saying "wrong image format for bootm command".

Who sets the default environment variables as seen above? Is it uboot-mkimage tool? How can I make it set "boot" to be the default command to boot using uImage? This error is basically generated because u-boot is missing "bootz" command. And as we can see above, it is looking for "bootz" command. So, when I google for 'bootz' command I find a patch. I don't know how to patch it to the u-boot.

karthikbhat77 commented 9 years ago

Hi Howard,

Today I was trying to edit environment variables, to change "bootz" to "bootm" command in it and I messed up. So, I formatted the whole SD card and re-wrote all the images (used shred command to format). To my surprise, even after I re-wrote all the images the environment variables were the same as I edited. It is then that it occurred to me that I had previously written binaries from Rocketboards.org on the same memory card which had the environment variables set to point to "bootz" command. I had formatted the sd card before I wrote images created from your tutorial. I don't know why the environment variables weren't deleted.

So, then I had another SD card and wrote the images generated using your tutorial and it no longer points to "bootz" command. Here's the transcript...

U-Boot SPL 2012.10 (Apr 02 2013 - 18:25:57) SDRAM : Initializing MMR registers SDRAM : Calibrationg PHY SEQ.C: Preparing to start memory calibration SEQ.C: CALIBRATION PASSED DESIGNWARE SD/MMC: 0

U-Boot 2012.10 (Feb 28 2013 - 21:33:41)

CPU : Altera SOCFPGA Platform BOARD : Altera SOCFPGA Cyclone 5 Board DRAM: 1 GiB MMC: DESIGNWARE SD/MMC: 0 *\ Warning - bad CRC, using default environment

In: serial Out: serial Err: serial Net: mii0 Warning: failed to set MAC address

Hit any key to stop autoboot: 0 reading uImage

3186312 bytes read reading socfpga.dtb

16289 bytes read

Booting kernel from Legacy Image at 00007fc0 ...

Image Name: Linux-3.9.0-00161-ged01b8c Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3186248 Bytes = 3 MiB Load Address: 00008000 Entry Point: 00008000 ERROR: Did not find a cmdline Flattened Device Tree Could not find a valid device tree SOCFPGA_CYCLONE5 #

Now, I don't understand why I'm getting this error. Could you please help me out.

Thank you, Karthik

karthikbhat77 commented 9 years ago

I got the OS to boot up today!

It looks like this particular SD card I am using wasn't getting formatted properly on a virtual machine. I was running Ubuntu 14 on VirtualBox. I then formatted on a laptop running ubuntu and re-wrote the SD card. It booted up just fine!

Thanks for this amazing tutorial. Could you also put up the steps you did to create the "bootloader.img". I would like to learn how to do it so I'll know the whole procedure.

Thanks again, Karthik