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.

AM335x eMMC boot



In the beagleboneblack by default it will boot from eMMC. i had erased the eMMC (NAND flash).  i want to copy MLO,uboot.bin and custom uImage  and rootfs into the eMMC?

ques:1: How to do NAND partition? what are the steps i need to follow?

ques:2: How to copy the boot image,kernel image and rootfs to NAND, so it can boot from nand automatically, when the board is booted.

  • Hi, Yordan
    Thanks for your reply.
    But how to flash the MLO, uboot.bin and initramfs file system in the NAND
  • Hello Sumanth,

    The used gate logic in the eMMC is NAND, but it should not get confused wit the NAND raw flash memories.

    sumanth g said:

    ques:1: How to do NAND partition? what are the steps i need to follow?

    You can simply format and partition the eMMC with the fdisk.

    sumanth g said:

    ques:2: How to copy the boot image,kernel image and rootfs to NAND, so it can boot from nand automatically, when the board is booted.

    Just copy the needed images from SD Card to the eMMC. Keep in mind the device which you has booted will always be mounted as mmc0. i.e. if you boot from eMMC it will be mounted as mmc0, if you boot from SD Card then the SD Card it will be mounted as mmc0.

    You can use the steps in this post as reference for eMMC programming.
    e2e.ti.com/.../1204926

    Best regards,
    Kemal

  • Hi Kemal,

    Thanks for your reply,

    ques:1: But how to do eMMC partition using fdisk in uboot prompt?

    with regards:

    sumanth

  • The fdisk is in Linux, there is no suitable command like fdisk in U-Boot. If you can't load the Linux from SD Card you try the tftp and NFS approach.

  • Hi kemal,
    i am able to boot the linux but unable to flash the files(MLO,uboot.bin,zImage) to NAND
    This are the steps i had followed.
    processors.wiki.ti.com/.../Sitara_Linux_Program_the_eMMC_on_Beaglebone_Black
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    step1: cd ~/ti-processor-sdk-linux-am335x-evm-02.00.00.00/board-support/u-boot-2015.07-gitAUTOINC+d49aa5effa
    step2: git branch emmc
    git checkout emmc
    step3: applied the patch provided form the above described link
    step4: export PATH="~/ti-processor-sdk-linux-am335x-evm-02.00.00.00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin":$PATH
    step 5:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=emmc am335x_boneblack_config all
    step 6: and copied the MLO,uboot.bin to sdcard
    step7: cd ~/ti-processor-sdk-linux-am335x-evm-02.00.00.00/board-support/linux-4.1.6+gitAUTOINC+52c4aa7cdb-g52c4aa7
    step 8: git branch flasher
    git checkout flasher
    step 9: download the tiny file system and create the directory and extracted the tiny file system to that directory.
    step 10:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig
    step 11:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
    in the general step -->Initial RAM Filesystem and RAM Disk (initramfs/initrd-->(given the patch of tiny file system)
    step 12:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
    step 13: copied the zImage and am335x-evm.dtb files to sdcard
    step 14: fatload mmc 0 0x80F80000 am335x-boneblack.dtb
    step 15: fatload mmc 0 0x80007FC0 zImage
    step 16:bootz 0x80007FC0 - 0x80F80000

    buy using the step 16, i am able to boot the linux. but when i changed the boot switch configuration to NAND boot. it was unable to boot from NAND.

    my question is how to flash the MLO,uboot.bin.zImage(with contain the files system) to NAND, so by changing the boot switch to nand configuration. It can boot linux without sdcard.


    with regards,
    sumanth.g
  • Could you boot from SD Card and post the output of this command:

    root@am335x-evm:# fdisk -l
  • [root@beaglebone]#fdisk -l

    Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
    255 heads, 63 sectors/track, 1936 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/mmcblk0p1 * 1 9 72261 c Win95 FAT32 (LBA)
    /dev/mmcblk0p2 10 1936 15478627+ 83 Linux

    Disk /dev/mmcblk1: 3825 MB, 3825205248 bytes
    4 heads, 16 sectors/track, 116736 cylinders
    Units = cylinders of 64 * 512 = 32768 bytes

    Device Boot Start End Blocks Id System
    /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA)
    /dev/mmcblk1p2 3105 116736 3636224 83 Linux

    Disk /dev/mmcblk1boot1: 4 MB, 4194304 bytes
    4 heads, 16 sectors/track, 128 cylinders
    Units = cylinders of 64 * 512 = 32768 bytes

    Disk /dev/mmcblk1boot1 doesn't contain a valid partition table

    Disk /dev/mmcblk1boot0: 4 MB, 4194304 bytes
    4 heads, 16 sectors/track, 128 cylinders
    Units = cylinders of 64 * 512 = 32768 bytes

    Disk /dev/mmcblk1boot0 doesn't contain a valid partition table
  • Now, could you follow these steps:

    1. Prepare a SD card either with the create-sdcard.sh script or:
    On the host PC with the SD card inserted:
    1.01. sudo fdisc /dev/sdd (or /dev/mmcblk0)
    1.02. o - this clears the existing partitions
    1.03. p - this lists all partition tables on the card (there should be none)
    1.04. n - create a new partition
    1.05. p - primary partition
    1.06. 1 - partition number
    1.07. 2048 - default value for the first sector
    1.08. +64M - last sector / partition size
    1.09. t - change the partition type (select partition 1)
    1.10. e - change tha partition type to "W95 FAT16 (LBA)"
    1.11. a - set the bootable flag for the selected partition (1)
    1.12. n - create a new partition
    1.13. p - primary partition
    1.14. 2 - partition number
    1.15. hit Enter to choose the default (next available) value for the first sector
    1.16. hit Enter to choose the default (last) value for the last sector
    1.17. p - this lists all partition tables on the card (there should be two)
    1.18. w - write all the above changes to disk
    1.19. sudo mkfs.vfat -F 16 /dev/mmcblk0p1 (or /dev/sdd1) - format the first partition
    1.20. sudo mkfs.ext3 /dev/mmcblk0p2 (or /dev/sdd2) - format the second partition
    1.21. copy the {MLO,u-boot.img,uEnv.txt} files to the first partition:
    # mkdir boot
    # sudo mount /dev/mmcblk0p1 boot
    # cp {MLO,u-boot.img,uEnv.txt} boot
    # sudo umount boot
    1.22. copy the root file system to the second partition:
    # mkdir root
    # sudo mount /dev/mmcblk0p2 root
    # tar -xf tisdk-rootfs-image-am335x-evm.tar.gz -C root
    # sudo umount root

    2. Run the BBB from the SD card (hold the USR button when powering the board up)

    3. ssh into the board:
    # ssh root@172.20.0.111

    4. The eMMC is /dev/mmcblk1. Format it this way:
    4.01. fdisk /dev/mmcblk1
    4.02. o - this clears the existing partitions
    4.03. p - this lists all partition tables on the card (there should be none)
    4.04. n - create a new partition
    4.05. p - primary partition
    4.06. 1 - partition number
    4.07. 2048 - default value for the first sector
    4.08. +16M - last sector / partition size
    4.09. t - change the partition type (select partition 1)
    4.10. e - change tha partition type to "W95 FAT16 (LBA)"
    4.11. a - set the bootable flag for the selected partition (1)
    4.12. n - create a new partition
    4.13. p - primary partition
    4.14. 2 - partition number
    4.15. hit Enter to choose the default (next available) value for the first sector
    4.16. hit Enter to choose the default (last) value for the last sector
    4.17. p - this lists all partition tables on the card (there should be two)
    4.18. w - write all the above changes to disk
    4.19. umount /dev/mmcblk1p1; mkfs.vfat -F 16 /dev/mmcblk1p1 - format the first partition
    4.20. umount /dev/mmcblk1p2; mkfs.ext3 /dev/mmcblk1p2 - format the second partition

    5. Copy the {MLO,u-boot.img,uEnv.txt} files to the first partition:
    # mkdir boot
    # mount /dev/mmcblk1p1 boot
    # cp {MLO,u-boot.img,uEnv.txt} boot
    # umount boot

    6. Copy the root file system to the second partition:
    # mkdir root
    # mount /dev/mmcblk1p2 root
    # tar -xf tisdk-rootfs-image-am335x-evm.tar.gz -C root
    # umount root

    7. Shutdown the BBB, remove the SD card and start it from the eMMC.

  • Hi Kemal,
    i had followed this steps know the board is booting from NAND successfully.
    can you explain this cmd in uboot
    uboot: cp.b 0x81000000 0x81020000 20000


    with regards,
    sumanth
  • Copies 128KiB from 0x81000000 to 0x81020000. See www.denx.de/.../UBootCmdGroupFlash

  • Hi Kemal,

    I have done the eMMC partition table as per your steps. done and created the tow partitions.

    Now i removed the sdcard and try to load from eMMC.

    How to boot by default from eMMC.

    Regards,

    Lofna

  • Hello Lofna,

    If the S2 switch button is not pressed, BBB by default boots from eMMC.

    Best regards,
    Kemal
  • Hi Kemal,

    Thanks for your response.

    Any u-boot boot args commands need to change for eMMC. Please share the same.

    I am using SDK7 from am335x evm reference. eMMC partitions are done and copied the files under boot  (/dev/mmcblk1p) & rootfs(/dev/mmcblk1p2 ).

    Regards,

    Lofna 

  • Please, check the patch in Step 2 at this link. You may need to implement it on SDK 7. In what stage it gets stuck? Does it prints any logs?

  • Hi,

    Bootloader running from sdcard (mmcblk0p1) partition and root file system running from eMMC (mmcblk1p2) partition. the below issue i am facing.

    when i am running my file system from sdcard its working, the same file system i have copied in to eMMC some of the boards are working.
    But some of them is giving below error and not accessing any other sysfs files.

    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/libcomposite/holders': No such file or directory
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/configfs/holders': No such file or directory
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/cryptodev/holders': No such file or directory

    [ 60.322297] PM: request_firmware failed

    What could be the reason.

    Regards,
    Lofna

  • Hi Kemal,

    Could you give your observations.

    Regards,

    Lofna

  • I am suspecting that the sysfs is not getting mounted on these boards. Are you able to login to a board at this stage? Could you share the output of mount command?

  • Hi,

    Find the below mount:

    root@am335x-evm:~# mount
    rootfs on / type rootfs (rw)
    /dev/root on / type ext4 (rw,relatime,data=ordered)
    devtmpfs on /dev type devtmpfs (rw,relatime,size=501624k,nr_inodes=125406,mode=755)
    proc on /proc type proc (rw,relatime)
    debugfs on /sys/kernel/debug type debugfs (rw,relatime)
    tmpfs on /var/volatile type tmpfs (rw,relatime,size=16384k)
    tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
    devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620

    root@am335x-evm:~# ls -al /sys/*
    block/ class/ devices/ fs/ power/
    bus/ dev/ firmware/ kernel/

    root@am335x-evm:~# lsmod
    Module Size Used by
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/cfg80211/holders': No such file or directory
    cfg80211 163054 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/usb_f_mass_storage/holders': No such file or directory
    usb_f_mass_storage 32479 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/libcomposite/holders': No such file or directory
    libcomposite 30114 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/configfs/holders': No such file or directory
    configfs 19119 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/bufferclass_ti/holders': No such file or directory
    bufferclass_ti 5405 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/omaplfb/holders': No such file or directory
    omaplfb 11426 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/pvrsrvkm/holders': No such file or directory
    pvrsrvkm 175491 -2
    libkmod: ERROR libkmod/libkmod-module.c:1796 kmod_module_get_holders: could not open '/sys/module/cryptodev/holders': No such file or directory

    rgds,lofna