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.

Script to Erase Emmc independently. Beagle Bone Black

Hi All,

I tried to find out any command s provided on u-boot prompt to erase the eMMC flash provided on Beagle bone black, but didnt find any commands to do for so.

Does anybody over here knows any script that can be triggered to erase the eMMC from root prompt ?


Thanks,

Hrishikesh.

  • Hi,
    I had been browsing through the web & found the below link
    dev.gentoo.org/.../install_emmc.xml

    formatting the eMMC :
    Step 1 : get the Script.
    # wget dev.gentoo.org/.../mkcard.sh
    Step 2 : Execute the script
    # bash mkcard.sh /dev/mmcblk1

    I would like to confirm . Is this right thing to do ? or anybody has verified this script ?

    Please share your views.

    Thanks,
    Hrishikesh.
  • Hi Hrishikesh,

    This script works from the Linux environment, not from u-boot. If you want to format eMMC from u-boot you can do this manually with the following commands:

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

    2. The eMMC is /dev/mmcblk1. Format it this way:
    2.01. fdisk /dev/mmcblk1
    2.02. o - this clears the existing partitions
    2.03. p - this lists all partition tables on the card (there should be none)
    2.04. n - create a new partition
    2.05. p - primary partition
    2.06. 1 - partition number
    2.07. 2048 - default value for the first sector
    2.08. +16M - last sector / partition size
    2.09. t - change the partition type (select partition 1)
    2.10. e - change tha partition type to "W95 FAT16 (LBA)"
    2.11. a - set the bootable flag for the selected partition (1)
    2.12. n - create a new partition
    2.13. p - primary partition
    2.14. 2 - partition number
    2.15. hit Enter to choose the default (next available) value for the first sector
    2.16. hit Enter to choose the default (last) value for the last sector
    2.17. p - this lists all partition tables on the card (there should be two)
    2.18. w - write all the above changes to disk
    2.19. umount /dev/mmcblk1p1; mkfs.vfat -F 16 /dev/mmcblk1p1 - format the first partition
    2.20. umount /dev/mmcblk1p2; mkfs.ext4 /dev/mmcblk1p2 - format the second partition

    Now you are formatted eMMC with 2 partitions. First is "W95 FAT16 (LBA)" and second is Linux. If you want to make this eMMC bootable you can make nwxt steps:

    3. 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

    4. 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

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

    BR
    Ivan
  • Thanks.. Ivan .. That helped me

  • Hi ivan,

    I forgot to add one comment : actually fdisk utility is supported from Linux environment . I didn't found any utility .. when I interrupted @u-boot.
  • Hi Hrishikesh,

    Yes, that right u-boot not support commands as fdisk. To see what you want you have to write the help command from u-boot and you will see all available u-boot commands.

    BR
    Ivan
  • Hi ,

    I have made the SD card bootable and made partions as boot, rootfs. Under boot i have copied MLO,u-boot.img.uEnv.txt and zImage. Under rootfs i have copied the root file system. After that i inserted SD card into BBB and hold the S2 button during power up , after this i can observe all four LEDs will blink and immediately USER LEDs (D2,D3 and D5 )will glow one after another stays solid ON ( D4 is permanantly OFF). I have waited an hour and removed SD card then powered to BBB nothing is working.

    what could be the problem ? Can any one one pls look into this..

    Thanks & Regards,

    Sudheer A.