This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: spi boot

Genius 5785 points
Part Number: AM3352

Tool/software: Linux

Hello,

I'd like to run SPI boot with AM335x GP-EVM without SD card slot because my target board doesn't have SD card slot. I'm using PSDK-Linux v4.0.0.

I built MLO.byteswap and u-boot.img using am335x_evm_spiboot_defconfig and wrote them to the SPI flash with StarterWare's SPI flash writer program.

http://processors.wiki.ti.com/index.php/AM335X_StarterWare_Booting_And_Flashing#Booting_Via_SPI

It looks like u-boot is working fine, but I've failed to start Kernel. To writie Kernel to SPI flash and enter "run spiboot", it stops at "Starting kernel ...".

I guess some u-boot environment variables are not appropriate. 'spiimgsize' is 0x362000, but the zImage by TFTP is 0x36d548. What should I set for 'spiimgsize'?

Also, since 'spisrcaddr' is 0xe0000, is it for the following erase command better to enter {$spisrcaddr} instead of 80000?

http://processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User%27s_Guide#Writing_to_SPI_from_U-Boot

I attached bootlog. Please give me some advice. I hope information about preparing dtb and targetfs to SPI flash too.

Regards,
Kazu

4338.bootlog.txt

I hope information about dtb, targetfs too.

  • Hi,

    We're looking into this. Feedback will be posted here.

    Best Regards,
    Yordan
  • Hello Yordan,

    Thank you for your reply. I set the start address for the erase command to 0xe00000 the same as 'spisrcaddr'. Then I set 'spiimgsize' to 0x370000 which is bigger than zImage. Also as in TI wiki, I wrote zImage to SPI flash using SD card slot. But the kernel booting is stopped.

    I think it's not enough for SPI Boot with 'run spiboot' only. How should I set the uboot environment variables for booting kernel? I hope information about preparing dtb and targetfs to SPI flash too.

    Regards,
    Kazu

  • Yordan,

    By writing the dtb to SPI flash, the kernel starts to boot although it stops with "Kernel Panic". Because I've not set up rootfs yet.

    According to the following file, it looks like there is no space for the dtb. Tentatively, I wrote the dtb in the 64 Kbyte area from 0x090000 to 0x0A00000. This is the bottom of the ​​u-boot area.

    u-boot/include/configs/am335x_evm.h
    /*
    * Default to using SPI for environment, etc.
    * 0x000000 - 0x020000 : SPL (128KiB)
    * 0x020000 - 0x0A0000 : U-Boot (512KiB)
    * 0x0A0000 - 0x0BFFFF : First copy of U-Boot Environment (128KiB)
    * 0x0C0000 - 0x0DFFFF : Second copy of U-Boot Environment (128KiB)
    * 0x0E0000 - 0x442000 : Linux Kernel
    * 0x442000 - 0x800000 : Userland
    */

    I changed some u-boot environment variables after writing MLO and u-boot to SPI flash.

    env default -f -a
    setenv spisrcaddr 0xe0000
    setenv spiimgsize 0x370000
    setenv spiboot "echo Booting from spi ...;" "run spiargs;" "sf probe ${spibusno}:0;" "sf read ${fdtaddr} 0x090000 0x10000;" "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize};" "bootz ${loadaddr} - ${fdtaddr}"
    saveenv

    Then, I wrote the dtb and the zImage to SPI flash.

    load mmc 0:2 ${loadaddr} boot/am335x-evm.dtb
    sf write ${loadaddr} 0x90000 ${filesize}

    sf erase ${spisrcaddr} +${spiimgsize}
    load mmc 0:2 ${loadaddr} boot/zImage
    sf write ${loadaddr} ${spisrcaddr} ${filesize}

    Finally, I turned the power of the EVM off and on again and entered "run spiboot".

    I attached the boot log. Please let me know if you have some advice about these changes.

    Also, after every processing saveenv, the kernel doesn't start to boot. In other words, "Starting kernel ..." is not displayed. I need to rewrite zImage to start SPI boot. I don't understand this cause.

    Regards,
    Kazu

    0435.bootlog2.txt

  • Kazu,

    I looked at your latest boot log, and I confirm that the kernel panic is caused by looking for rootfs in SPI flash chip, but rootfs partition (dev/mtdblock4) do not exist

    Kernel command line: console=ttyO0,115200n8 root=/dev/mtdblock4 rw rootfstype=jffs2

    VFS: Cannot open root device "mtdblock4" or unknown-block(0,0): error -19

    [    1.852945] Please append a correct "root=" boot option; here are the available partitions:

     

    The most important variables here are spiroot and spirootfstype. You should enable mtbblocks in kernel.

    http://processors.wiki.ti.com/index.php/Linux_Core_SPI_User's_Guide

     

     

  • Pavel,

    Thank you for your information.

    The following thread you suggested has helped me. I was able to check the operation of SPI flash boot and NFS mount with GP-EVM.

    https://e2e.ti.com/support/embedded/linux/f/354/t/579034

    Also, I found the cause of corruption of zImage when I issued saveenv. That was a comment mistake for am335x_evm.h.

    Regards,
    Kazu

  • Kazu,

    Glad to see you have fix it. Can you please close/verify/resolve this thread.

    Regards,
    Pavel