2
votes

I have a Freescale I.MX ARM board for which I am preparing the bootloader, kernel and Root filesystem on the sdcard. I am a little confused about the order in which I partition and copy my files into sdcard. Let us say I have an empty sdcard 4GB size. I used gparted to first parition it into:

Firts partition 400 MB size as FAT32 system. this is my boot partition Second partition is the rest of the card as ext3. This is my root file system partition.

Let us say my sdcard is under /dev/sdb.

Now I have seen many documents differing slightly in the way of copying the boot files.

Which is the right way?

Method 1:

(without mounting sdb partitions: sudo dd if=u-boot.bin of=/dev/sdb bs=512 seek=2 sudo dd if=uImage of=/dev/sdb bs=512 seek=2

Mount sdb2 for copying rootfs: mount /dev/sdb2 /mnt/rootfs copy rootfs: tar -xf tarfile /mnt/rootfs

Method 2: Mount sdb1 boot partition: mount /dev/sdb1 /mnt/boot copy uboot and kernel: cp u-boot.bin /mnt/boot/ cp uImage /mnt/boot/

Then copy rootfs as above!

Which is the correct one. I tried two but the sddcard is not even booting. When I tried method 1, the card boot up until it says the rootfs is not found in the partition. I removed the card and inserted and found that the first fat 32 partition is somehow 'destroyed' as it says 'unallocated' on gparted.

Please help.

3

3 Answers

0
votes

You need to mark first partition as bootable. Check your first partition details in gparted or disk utility.

From disk utility you cab mark a partition bootable. by selecting specific partition and going into 'more action' option --> 'edit partition type'.

0
votes

below is script to flash binaries onto SD card for my Arndale OCTA board. You can see the placement of bootloader binaries:

BL1

dd iflag=dsync oflag=dsync if=arndale_octa.bl1.bin of=/dev/sde bs=512 seek=1

BL2

dd iflag=dsync oflag=dsync if=../arndale_octa.bl2.bin of=/dev/sde bs=512 seek=31

uboot

dd iflag=dsync oflag=dsync if=u-boot.bin of=/dev/sde bs=512 seek=63

kernel and trust software , ....

Please notes: 1) The partition table is at SDcard offset 0 (seek 0), then you have to run:fdisk /dev/sde and create paratiions that does not overlapped with blocks ocppuied by kernel or trust software. 2) add the "dsync" option in dd command to gaurantee every written data is immediately flushed into SD card

0
votes

In the most of the cases, imx processor requires bootloader at 0x400 offset. So whatever you are doing for u-boot is correct, you need to use dd command for that.

sudo dd if=u-boot.bin of=/dev/sdb bs=512 seek=2

While partitioning the sd card, Make sure that you are keeping enough room for u-boot image. So start your 1st bootable partition at let's say 1 MB offset.

You can simply copy your uImage and environment variables (uEnv.txt or boot.scr) through cp command.

For rootfs also, You can follow the same steps as kernel.