NetBSD-current for openmoko GTA02

Peter Tworek tworaz666 at gmail.com
Sat Dec 17 16:44:34 CET 2011


On 12/07/2011 06:27 AM, Timo Juhani Lindfors wrote:
> Peter Tworek <tworaz666 at gmail.com> writes:
>> For some time now I've been spending some of my free time on getting
>> NetBSD running on my Freerunner.
> Interesting, do you have this work in some version control system?
> Would be nice to see all the steps :-)
It took me some time, but the source code of the port can be downloaded
from github: https://github.com/tworaz/src/commits/gta02-5.99.58.
Building the code should be straightforward if you have some experience
with NetBSD. Just checkout the sources somewhere, enter the directory
from command line and execute:
# ./build.sh -N 1 -u -U -O ../obj-evbarm -T ../tools-evbarm -m evbarm -V
HAVE_GCC=45 build
# ./build.sh -N 1 -u -U -O ../obj-evbarm -T ../tools-evbarm -m evbarm -V
HAVE_GCC=45 kernel=GTA02

Depending on your hardware this can take several hours to complete.
After it's done the kernel images should be available under
../obj-evbarm/sys/arch/evbarm/compile/GTA02/{netbsd, netbsd.ub,
netbsd.gz.ub}. Note however that this is just a kernel image without any
kind of ramdisk. The sources for the ramdisk I've used in my previous
image can be found here: https://github.com/tworaz/netbsd-gta02-ramdisk.
To build it just add tools-evbarm from kernel build process yo your
path, enter checked out ramdisk repository and run:
# ./build.sh

This should be much quicker to complete. The result of the build process
is ramdisk.fs file. To embed the ramdisk inside the kernel I use the
following shell script: (You'll have to change _WRKDIR value to make it
work)
#!/bin/sh

_WRKDIR=/home/tworaz/devel/NetBSD
_OBJDIR=$_WRKDIR/obj-evbarm
_TOOLDIR=$_WRKDIR/tools-evbarm

_MDSETIMG=$_TOOLDIR/bin/arm--netbsdelf-mdsetimage
_OBJCOPY=$_TOOLDIR/bin/arm--netbsdelf-objcopy
_MKUBOOTIMG=$_TOOLDIR/bin/nbmkubootimage

_MKUBOOTIMG_ARGS="-A arm -T kernel -a 0x30200000 -n NetBSD/gta02 -C gz"

echo -n "Removing old kernel: "
rm -f netbsd.gz.ub
echo "OK"

echo -n "Obtaining new binaries: "
cp $_OBJDIR/sys/arch/evbarm/compile/GTA02/netbsd .
cp $_WRKDIR/ramdisk-gta02/ramdisk.fs .
echo "OK"

echo -n "Preparing new kernel image: "
$_MDSETIMG netbsd ramdisk.fs
$_OBJCOPY -S -O binary netbsd netbsd.bin
gzip -c netbsd.bin > netbsd.bin.gz
$_MKUBOOTIMG $_MKUBOOTIMG_ARGS netbsd.bin.gz netbsd.gz.ub > /dev/null
echo "OK"

echo -n "Removing temporary files: "
rm -f ramdisk.fs
rm -f netbsd
rm -f netbsd.bin
rm -f netbsd.bin.gz
echo "OK"

_SIZE=`du -k netbsd.gz.ub| awk '{ print $1 }'`
echo "New Image Size: $_SIZE kB"

The final image should boot on the Freerunner using the procedure I've
described in my first email.

/ptw



More information about the community mailing list