Wednesday, October 15, 2008

Booting Linux from SD card on my Beagle

It was the day when i started my battle to bring up Linux on my Beagle from SD card . After a long struggle , i learnt two things
* For my Kernel , MMC and SD cards are different .
* SD fs should be built with ROOT user .

The MMC/SD card can be partitioned using gparted .
Partition 1 : VFAT , flag =boot (uImage , MLO)
Partition 2: EXT-2 (file system)

The uboot ENV params are here :
setenv bootcmd 'mmcinit;fatload mmc 0 0x80300000 uImage;bootm 0x80300000';
setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 rw rootdelay=1 nohz=off

Some tips on RAMDISK ...

# on the linux host
mkdir workspace
cd workspace
gzip -cd /rd.ext2-bin > ramdisk.orig
mkdir mountpoint
mount -o loop ..../workspace/ramdisk.orig ..../workspace/mountpoint
# should see all the files, etc. in "mountpoint" subdirectory
# you can make your changes there - or clone the filesytem and
# modify the clone

# then copy somewhere...
mkdir newFs
tar cf - -C mountpount . | tar xvf - -C newFs
umount mountpoint ;# unmount the old image
# then make whatever changes are wanted in 'newFs'
mkdir newFs/home/user ....
// whatever

# tar it up so we can do this more easily next time
tar zcf ramFileSystem.tgz --C newFs .

# then reverse the steps
mkdir -p newFsMountPoint
dd if=/dev/zero of=newRamDiskImage bs=8M count=1 ;# create the file
mkfs.ext2 newRamDiskImage
mount -o loop newRamDiskImage .../newFsMountPoint
tar zxf ramFileSystem.tgz -C ../newFsMountPoint

# finally, unmount and zip
umount .../newFsMountPoint
gzip -c newFsMountPoint myNewRd-ext2.bin
... then copy the file to the SD card
[http://groups.google.com/group/beagleboard/browse_thread/thread/16dc0686c1a78420]

No comments: