Panda How to Barebox

From eLinux.org
Revision as of 10:45, 27 October 2011 by Plagnioj (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

For this How-to, we will use the Code Sourcery G++ version arm-2009q3. It should already be installed on your system. MLO, u-boot and kernels have also been successfully built with arm-2010q1.

MLO

First, let's get the x-loader source code and build it. But the difference with Barebox is that the x-loader is just a down size of Barebox it self

git clone git://git.pengutronix.de/git/barebox.git

Next, select the panda config:

mkdir MLO
make CROSS_COMPILE=Path_to_your/arm-2009q3/bin/arm-none-linux-gnueabi-  O=MLO panda_xload_defconfig

Now compile MLO:

make CROSS_COMPILE=Path_to_your/arm-2009q3/bin/arm-none-linux-gnueabi- O=MLO

This should produce the MLO file as MLO/barebox.bin.

Barebox

Now for Barebox:

Next, select the panda config:

mkdir boot
make CROSS_COMPILE=Path_to_your/arm-2009q3/bin/arm-none-linux-gnueabi- O=boot panda_defconfig

Now compile Barebox:

make CROSS_COMPILE=Path_to_your/arm-2009q3/bin/arm-none-linux-gnueabi- O=boot

This should produce boot/barebox.bin

Creating a working SD card

Use this script to prepare an SD card with the small vfat partition and the larger ext2/3 partition (it has been posted many places, I take no credit for it btw, the card needs to be larger than 64Mbytes since this original script wants to make a 64Mbyte vfat partition) You may need to be root for some of the following operations. For the feint of heart, you can use sudo instead in the right places.

#!/bin/sh
if [ ! "$1" = "/dev/sda" ] ; then
	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,*
		echo ,,,-
		} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
		mkfs.vfat -F 32 -n "boot" ${DRIVE}1
		mke2fs -j -L "rootfs" ${DRIVE}2
	fi 
fi

More to come....