Here are the summary:
- Configure memory card for boot partition
- Compile u-boot, kernel and busybox
- Boot u-boot and linux kernel from memory card
- Load rootfs from NFS
Memory Card Preparation
- Determine device name for memory card:
sudo fdisk -l
- List of attached storage along with its device name are listed:
Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0004b2f5 Device Boot Start End Blocks Id System /dev/sda1 * 2048 33554431 16776192 83 Linux /dev/sda2 33556478 41940991 4192257 5 Extended /dev/sda5 33556480 41940991 4192256 82 Linux swap / Solaris Disk /dev/sdd: 3963 MB, 3963617280 bytes 255 heads, 63 sectors/track, 481 cylinders, total 7741440 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdd1 * 63 144584 72261 c W95 FAT32 (LBA)
- Choose the device name with match of storage size. For 4GB (3963 MB) memory card, the device is /dev/sdd.
- The following script (mmc.sh) is used to configure and format boot partition:
#!/bin/bash if [ ! "$1" = "/dev/sda" ] ; then unset LANG DRIVE=$1 if [ -b "$DRIVE" ] ; then dd if=/dev/zero of=$DRIVE bs=1024 count=1024 SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` echo DISK SIZE - $SIZE bytes CYLINDERS=`echo $SIZE/255/63/512 | bc` echo CYLINDERS - $CYLINDERS { echo ,9,0x0C,* } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE umount ${DRIVE}1 mkfs.vfat -F 32 -n "boot" ${DRIVE}1 fi fi
- Make the script executable:
chmod +x mmc.sh
- Run the script with super user (su) and memory card device name (/dev/sdd)
sudo mmc.sh /dev/sdd
Compile U-Boot
- Install git for Ubuntu
sudo apt-get install git
- Obtain U-Boot source
git clone git://git.denx.de/u-boot.git
- Set environment variables for architecture and cross-compiler
export ARCH=arm && export CROSS_COMPILE=/usr/local/bin/arm-none-linux-gnueabi-
- Compile and generate bootloader binaries (MLO, u-boot.img)
make omap4_panda_config && make
Compile Linux Kernel
- Obtain kernel source
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- Generate configuration for PandaBoard
make omap2plus_defconfig
- Customize configuration
make menuconfig
- Enable EHCI HCD (USB 2.0) support under Device Drivers > USB Support)
Device Drivers --> [*] USB support --> --> [*] EHCI HCD (USB 2.0) support
- Compile and generate kernel binary (uImage)
make uImage
Loading Binaries
- Create the boot script (boot.script) with the following content:
fatload mmc 0:1 0x80000000 uImage setenv bootargs vram=32M fixrtc console=ttyO2,115200n8 mem=1G@0x80000000 smsc95xx.macaddr=76:2F:97:85:4F:66 root=/dev/nfs rw nfsroot=192.168.0.103:/home/yickhong/PandaNFS,nolock,wsize=1024,rsize=1024 ip=dhcp rootdelay=2 bootm 0x80000000
- Generate boot image (boot.scr) with boot script:
mkimage -A arm -T script -C none -n "Boot Image" -d boot.script boot.scr
- Copy boot image (boot.scr), bootloader (MLO, u-boot.img) and kernel binary (uImage) to memory card
Compile BusyBox
- Obtain BusyBox source
git clone git://busybox.net/busybox.git
- Generate default configuration
make defconfig
- Customize configration for PandaBoard
make menuconfig
- Under BusyBox Settings > Build Options:
Enable Build BusyBox as a static binary (no shared libs)
Set additional CFLASGS (-march=armv7-a -mthumb)
- Compile and generate BusyBox binary
make && make install
- Prepare Root File System in _install (default directory where busybox binary is generated)
mkdir proc mkdir sys mount -t proc none /proc mount -t sysfs none /sys mkdir dev mknod dev/tty2 c 4 2 mknod dev/tty3 c 4 3 mknod dev/tty4 c 4 4
- Create start-up script (_install/etc/init.d/rcS)
#!/bin/sh mount -t proc none /proc mount -t sysfs none /sys /sbin/mdev -s
- Make the script executable
chmod +x _install/etc/init.d/rcS
- Copy _install directory to /PandaNFS
Install and Configure NFS server
- Install
sudo apt-get install nfs-common nfs-kernel-server
- Configure
Make PandaNFS as rootfs by editting /etc/exports
/PandaNFS 192.168.0.0/24(rw,sync,no_root_squash,no_subtree_check)
Restart NFS server
/etc/init.d/nfs-kernel-server restart
All set, insert memory card to PandaBoard and boot them!
Check out the video on linux and BusyBox running in PandaBoard. Special thanks to Tham who rent his PandaBoard!