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.

AM3352: .img file written to SD card not bootable

Part Number: AM3352

Tool/software:

If I write directly to an SD card from linux it will be bootable by the am335x.

If I create an image file using a loop device and then program that img to the SD card in windows using Win32DiskImager, it will not boot.

Both methods used to work but now I am having issues with the second method. Any ideas on why it is no longer working?

Here are the commands I use to create the SD card (working):

umount /dev/sdb*
dd if=/dev/zero of=/dev/sdb bs=512 count=2 conv=fsync

fdisk /dev/sdb << EOF
n
p
1

+128M
t
c
a
w
EOF

partprobe -s /dev/sdb
mkfs.vfat -I -F 32 -n "BOOT" /dev/sdb1
partprobe /dev/sdb

mkdir -p /mnt/linuxp1

mount -t vfat /dev/sdb1 /mnt/linuxp1

cp MLO /mnt/linuxp1
cp u-boot.img /mnt/linuxp1

sync
sync

umount -f /dev/sdb*

Here are the additional commands that I run to create the img file.  The image file is created successfully and I am able to write it to the SD card.  It just won't boot.

loop_device=`losetup -f`
dd if=/dev/zero of=linux.img bs=1024 count=2097152
losetup $loop_device linux.img

run the same commands above used to create the SD card, only instead of using /dev/sdb I will use $loop_device

losetup -d $loop_device

  • I found a solution.  I needed to add the -a option to the mkfs.vfat command for the boot partition: 

    mkfs.vfat -Ia -F 32 -n "BOOT" /dev/sdb1

    -a              Disable alignment of data structures

    Maybe consider adding this to the create-sdcard.sh script.