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.

BBB 烧写 EMMC 不能从 EMMC 启动



测试的板子,使用 BBB。制作 SD 卡,启动 linux,MLO uboot 内核使用的是自己的。文件系统使用的是 **AM335x Beaglebone Black eMMC烧写记录** 提供的 FlasherFS.tar.gz 。

在 linux 启动之后,执行 ./debrick.sh (已经将 DRIVE 指定为 "/dev/mmcblk1" 了)。成功创建了两个分区,mmcblk1p1  mmcblk1p2 ,且已经将 ML0  u-boot.img uExt.t uImage 解压到 /dev/mmcblk1p1 分区。文件系统解压到 /dev/ mmcblk1p2 .

可是,断电,拔掉 SD 卡,重新上电 ,设备不能从 EMMC 启动。一直打印 "CCCCCCCC"

IT 的朋友,求知识,求指导

  •  帖子不能沉。

    EMMC 被创建为两个分区了,第一个分区是 fat 格式,从 SD 启动 linux 确认查看了 ,MLO、u-boot.img、uExt.txt uImage, 确实已经写入到 mmcblk1p1 了。板子是 BBB 的,就是不能启动

  • EMMC 使用的是 4GB 的大小,接在 MMC1 上面,型号是 emmc_ps8210_v451_80s_153b_wt.pdf。查阅了文档,EMMC 的 version 是 4.51。所以,设备接在 MMC1 接口上,应该是没有问题的。

  • 我在 BBB 的公版上,验证没有通过。文件系统和脚本,是官方提供的,内核是自己的,但是是支持EXT3/4 等格式的。从 /media/mmcblk1p1 查看可以得知,MLO、u-boot.img、uExt.txt 是正确写入到 fat 分区里面了。

  • 烧写的log有没有?

  • ./debrick.sh
    ****************************************************
    ****************************************************

    Sitara Example Flashing Script - 02/11/2014

    1+0 records in
    1+0 records out
    SIZE = 3825205248
    CYLINDERS = 465
    No partition found. Continuing.
    Partitioning the eMMC...
    Checking that no-one is using this disk right now ...
    [ 4320.991424] mmcblk1: unknown partition table
    OK

    Disk /dev/mmcblk1: 465 cylinders, 255 heads, 63 sectors/track

    sfdisk: ERROR: sector 0 does not have an msdos signature
    sfdisk: /dev/mmcblk1: unrecognized partition table type

    Old situation:
    sfdisk: No partitions found

    New situation:
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start End #cyls #blocks Id System
    /dev/mmcblk1p1 * 0+ 89 90- 722893+ c W95 FAT32 (LBA)
    /dev/mmcblk1p2 91 464 374 3004155 83 Linux
    /dev/mmcblk1p3 0 - 0 0 0 Empty
    /dev/mmcblk1p4 0 - 0 0 0 Empty
    Successfully wrote the new partition table

    Re-reading the partition table ...
    [ 4321.593139] mmcblk1: p1 p2

    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)
    [ 4323.968322] kjournald starting. Commit interval 5 seconds
    [ 4323.976013] EXT3-fs (mmcblk1p2): using internal journal
    [ 4323.981536] EXT3-fs (mmcblk1p2): mounted filesystem with ordered data mode
    Found mounted partition(s) on /dev/mmcblk1: /media/mmcblk1p1 /media/mmcblk1p2
    4k erase on /dev/mmcblk1p1
    1+0 records in
    1+0 records out
    4k erase on /dev/mmcblk1p2
    1+0 records in
    1+0 records out
    1+0 records in
    1+0 records out
    Formatting the eMMC into 2 partitions...
    mkfs.vfat 2.11 (12 Mar 2005)
    mke2fs 1.42.1 (17-Feb-2012)
    Discarding device blocks: done
    Filesystem label=rootfs
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    188048 inodes, 751038 blocks
    37551 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=771751936
    23 block groups
    32768 blocks per group, 32768 fragments per group
    8176 inodes per group
    Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912

    Allocating group tables: done
    Writing inode tables: done
    Creating journal (16384 blocks): done
    Writing superblocks and filesystem accounting information: done

    Formatting done.
    [ 4344.397766] kjournald starting. Commit interval 5 seconds
    [ 4344.405395] EXT3-fs (mmcblk1p2): using internal journal
    [ 4344.410919] EXT3-fs (mmcblk1p2): mounted filesystem with ordered data mode
    Copying Files...
    real 0m 0.63s
    user 0m 0.40s
    sys 0m 0.14s
    Boot partition done.
    real 0m 1.07s
    user 0m 0.66s
    sys 0m 0.32s
    RootFS partition done.
    It took 31 seconds to complete this task...

    ********************************************
    Sitara Example Flash Script is complete.

  • 我将 boot_partition.tar.gz  rootfs_partition.tar.gz  debrick.sh  放在 /home/root 目录下面

    因为是SD 卡启动的,所以对 debrick.sh  DRIVER 设置为 /dev/mmcblk1

  • 在 SD 卡 启动的 MLO 和 u-boot.img 和 EMMC 启动的 MLO、 u-boot.img 是一样的,没错吧

  • Jian zhou,快点出来,帮忙解决问题吧。这个问题,卡了我快一周了

  • SD卡启动试过没有?你的MLO确定是可以正常启动的么?

  • SD卡 可以启动,MLO 没有问题。 SD 卡启动了,通过 SD 卡启动了 linux(文件系统你们的 FlasherFS.tar.gz),系统起来之后,手动运行了  debrick.sh 脚本。emmc 设备 fat 分区的 MLO 和 SD 启动的 MLO,是同一份 MLO。

  • 那就很奇怪了,我在BBB板上验证很多次,至少MLO引导是没有问题的。

    sysboot没有问题吧?

  • echo "****************************************************"
    echo "****************************************************"
    echo ""
    echo "Sitara Example Flashing Script - 02/11/2014"
    echo ""

    STARTTIME=$(date +%s)

    ##---------Start of variables---------------------##

    ## Set Server IP here
    #SERVER_IP="192.168.100.1"

    ## Names of the images to grab from TFTP server
    BOOT_PARTITION="boot_partition.tar.gz"

    ## Rename rootfs as needed depending on use of tar or img
    ROOTFS_PARTITION="rootfs_partition.tar.gz"
    ## ROOTFS_PARTITION="rootfs_partition.img.gz"

    ## Declare eMMC device name here
    DRIVE="/dev/mmcblk1"

    ##----------End of variables-----------------------##

    ## TFTP files from host. Edit the files and host IP address for your application.
    ## We are grabbing two files, one an archive with files to populate a FAT partion,
    ## which we will create. Another for a filesystem image to 'dd' onto an unmounted partition.
    ## Using a compressed tarball can be easier to implement, however, with a large file system
    ## with a lot of small files, we recommend a 'dd' image of the partition to speed up writes.
    ## echo "Getting files from server: ${SERVER_IP}"
    ## time tftp -b 4096 -g -r ${BOOT_PARTITION} ${SERVER_IP} &
    ## boot_pid=$!
    ## time tftp -b 4096 -g -r ${ROOTFS_PARTITION} ${SERVER_IP} &
    ## rootfs_pid=$!


    ## Kill any partition info that might be there
    dd if=/dev/zero of=$DRIVE bs=4k count=1
    sync
    sync

    ## Figure out how big the eMMC is in bytes
    SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
    echo "SIZE = $SIZE"
    ## Translate size into segments, which traditional tools call Cylinders. eMMC is not a spinning disk.
    ## We are basically ignoring what FDISK and SFDISK are reporting because it is not really accurate.
    ## we are translating this info to something that makes more sense for eMMC.
    CYLINDERS=`echo $SIZE/255/63/512 | bc`
    echo "CYLINDERS = $CYLINDERS"
    ## Check to see if the eMMC partitions have automatically loaded from the old MBR.
    ## This might have occured during the boot process if the kernel detected a filesystem
    ## before we killed the MBR. We will need to unmount and kill them by writing 4k zeros to the
    ## partitions that were found.

    check_mounted(){
    is_mounted=$(grep ${DRIVE}p /proc/mounts | awk '{print $2}')

    if grep -q ${DRIVE}p /proc/mounts; then
    echo "Found mounted partition(s) on " ${DRIVE}": " $is_mounted
    umount $is_mounted
    counter=1
    for i in $is_mounted; do \
    echo "4k erase on ${DRIVE}p${counter}";
    dd if=/dev/zero of=${DRIVE}p${counter} bs=4k count=1;
    counter=$((counter+1));
    done
    else
    echo "No partition found. Continuing."
    fi
    }

    check_mounted;

    ## Partitioning the eMMC using information gathered.
    ## Here is where you can add/remove partitions.
    ## We are building 2 partitions:
    ## 1. FAT, size = 9 cylinders * 255 heads * 63 sectors * 512 bytes/sec = ~70MB
    ## 2. EXT3, size = 223 ($CYLINDERS-[9 for fat]) cylinders * 255 heads * 63 sectors * 512 bytes/sec = ~1l.7GB
    ##
    ## You will need to change the lines ",9,0c0C,*", "10,,,-" to suit your needs. Adding is similar,
    ## but you will need to be aware of partition sizes and boundaries. Use the man page for sfdisk.
    echo "Partitioning the eMMC..."
    sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
    ,90,0x0C,*
    91,,,-
    EOF

    ## This sleep is necessary as there is a service which attempts
    ## to automount any filesystems that it finds as soon as sfdisk
    ## finishes partitioning. We sleep to let it run. May need to
    ## be lengthened if you have more partitions.
    sleep 2

    ## Check here if there has been a partition that automounted.
    ## This will eliminate the old partition that gets
    ## automatically found after the sfdisk command. It ONLY
    ## gets found if there was a previous file system on the same
    ## partition boundary. Happens when running this script more than once.
    ## To fix, we just unmount and write some zeros to it.
    check_mounted;

    ## Clean up the dos (FAT) partition as recommended by SFDISK
    dd if=/dev/zero of=${DRIVE}p1 bs=512 count=1

    ## Make sure posted writes are cleaned up
    sync
    sync

    ## Format the eMMC into 2 partitions
    echo "Formatting the eMMC into 2 partitions..."

    ## Format the boot partition to fat32
    mkfs.vfat -F 32 -n "boot" ${DRIVE}p1

    ## Format the rootfs to ext3 (or ext4, etc.) if using a tar file.
    ## We DO NOT need to format this partition if we are 'dd'ing an image
    ## Comment out this line if using 'dd' of an image.
    mkfs.ext3 -L "rootfs" ${DRIVE}p2

    ## Make sure posted writes are cleaned up
    sync
    sync
    echo "Formatting done."

    ## Make temp directories for mountpoints
    mkdir tmp_boot

    ## Comment this line out if using 'dd' of an image. It is not needed.
    mkdir tmp_rootfs

    ## Mount partitions for tarball extraction. NOT for 'dd'.
    mount -t vfat ${DRIVE}p1 tmp_boot

    ## If 'dd'ing the rootfs, there is no need to mount it. Comment out the below.
    mount -t ext3 ${DRIVE}p2 tmp_rootfs

    ## Wait for boot to finish tftp
    wait $boot_pid
    echo "Copying Files..."
    time tar -xf ${BOOT_PARTITION} -C tmp_boot
    sync
    sync
    umount ${DRIVE}p1
    ##rm ${BOOT_PARTITION}
    echo "Boot partition done."

    ## Wait for rootfs to finish tftp
    wait $rootfs_pid
    ## If using a tar archive, untar it with the below.
    ## If using 'dd' of an img, comment these lines out and use the below.
    time tar -xf ${ROOTFS_PARTITION} -C tmp_rootfs
    sync
    sync
    umount ${DRIVE}p2
    ##rm ${ROOTFS_PARTITION}
    echo "RootFS partition done."

    ## If using 'dd' of an img, uncomment these lines.
    ## If using a tar archive, comment out these lines and use the above.
    ## time gunzip -c ${ROOTFS_PARTITION} | dd of=${DRIVE}p2 bs=4k
    ## sync
    ## sync
    ## echo "Rootfs partition done."

    ## The block below is only necessary if using 'dd'.
    ## Force check the filesystem for consistency and fix errors if any.
    ## Resize partition to the length specified by the MBR.
    ## /sbin/e2fsck -fy ${DRIVE}p2
    ## /sbin/resize2fs ${DRIVE}p2

    ENDTIME=$(date +%s)
    echo "It took $(($ENDTIME - $STARTTIME)) seconds to complete this task..."
    ## Reboot
    echo ""
    echo "********************************************"
    echo "Sitara Example Flash Script is complete."
    echo ""


    这个脚本,是你们的,几乎没怎么修改,
  • sysboot  的话, BBB 的板子进行进行测试 ,默认的 11100 ,MMC1-> MMC0 -》 UART0 -》 USB0。

    咨询下,你可以将你们在 BBB 测试的,所有文件,重新打包给我不。我现在不知道 ,感觉都是按照官方的流程走的,不知道是哪里出了问题。

  • 能不能帮忙我排除一下问题,我这边实在定位不到问题了。

    能不能麻烦你们,用我刚发的脚本,做测试。确认下,是不是脚本的问题,还是其他的问题

  • 你手上有几个BBB的板子?有没换个板子试试。

    如果硬件正常,烧进去的MLO至少能跑起来。

  • 我有两个 BBB 的板子,但是都不能起来。

    如果,你那边可以的话,能不能麻烦你,用我前面的脚本,去跑,如果一切正常,顺利从 EMMC 启动的话,说明脚本是没有问题的。

    现在我这边,定位不到问题。

  • 你用的是SDK06的MLO么?如果不是,用附件的试下。

    MLO-am335x-evm