zink's Blog

Anything stupid

Gentoo on Wandboard DL

2013-10-14 by zink, tagged as arm, linux


[IMG SRC: WIKI WIKI]

I recently bought me a Wandboard Dual for developement purposes.
As I'm using Gentoo on every machine I own, it was clear for me that this system will also run Gentoo.


[IMG SRC: OWN]

This is a little howto on preparing a SD-Card for the wandboard. You will end up with a booted stage3 installation of Gentoo.

I'm asuming, that you're running Gentoo as host. And have proper knowledge of it.
!! TAKE CARE TO MODIFY THE FOLDER/DEVICE NAMES !!

Start working

su - root

Prepare SD-Card

fdisk /dev/sdf #FIRST SECTOR=8192
mkfs.ext3 /dev/sdf1 # /
mkfs.ext4 /dev/sdf2 # /home
mkfswap /dev/sdf3 # swap
mkdir /mnt/gentoo
mount /dev/sdf1 /mnt/gentoo
cd /mnt/gentoo
wget http://distfiles.gentoo.org/releases/\
            arm/autobuilds/current-stage3-armv7a/\
            stage3-armv7a-20131007.tar.bz2
tar xpvf stage3-armv7a-20131007.tar.bz2
rm -f stage3-armv7a-20131007.tar.bz2
cp /etc/shadow ./etc #COPY PASSWORDLIST
# MODIFY THE FSTAB IN /mnt/gentoo/etc/ !!!

Prepare working directories

cd ~/
mkdir work
cd work
wget http://www.wandboard.org/images/downloads/\
            wandboard-sdk-20130514.tar.xz
#DOWNLOAD CODE SOURCERY G++ 2010 9-50 
#https://sourcery.mentor.com/sgpp/lite/arm/portal/release1600
tar xvf wandboard-sdk-20130514.tar.xz
tar xvf arm-2010.09-50-arm-none-linux-gnueabi-\
        i686-pc-linux-gnu.tar.bz2
export CC=~/work/arm-2010.09/bin/arm-none-linux-gnueabi-
cd wandboard-sdk-20130514

U-Boot

cd u-boot-2013.04-wand
make ARCH="arm" CROSS_COMPILE=${CC} -j4 wandboard_dl
cd ..

U-Boot Bootlogo (optional)

cd boot_logo
wget http://zink.hexatux.org/downloads/wandboard/gentoo_logo.png
./mkbootlogo.sh gentoo_logo.png
cd ..

Kernel

cd linux-3.0.35-imx6-wand
make ARCH="arm" CROSS_COMPILE=${CC} -j4 wandboard_defconfig
make ARCH="arm" CROSS_COMPILE=${CC} -j4 menuconfig
make ARCH="arm" CROSS_COMPILE=${CC} -j4
make ARCH="arm" CROSS_COMPILE=${CC} -j4 modules
make ARCH="arm" CROSS_COMPILE=${CC}\ 
     INSTALL_MOD_PATH=/mnt/gentoo -j4 modules_install
make ARCH="arm" CROSS_COMPILE=${CC} -j4 uImage
cd ..

Firmware

cp firmware /mnt/gentoo/lib/

Flash U-Boot/U-Boot Bootlogo/Kernel to SD

dd if=./u-boot-2013.04-wand/u-boot.imx\ 
   of=/dev/sdf\
   bs=1k\
   seek=1
dd if=./linux-3.0.35-imx6-wand/arch/arm/boot/uImage\
   of=/dev/sdf\
   bs=1M\
   seek=1
#OPTIONAL:
dd if=./boot_logo/out.bmp.gz\
   of=/dev/sdf\
   bs=512k\
   seek=1\
   count=1

Finish Host side work

umount /mnt/gentoo
sync
Now remove the SD-Card and put it into the SD socket on the CPU module of the Wandboard.

Prepare Wandboard

Connect a Null modem cable to the Wandboard and your host. Start Minicom on your host. Configure Minicom for the correct interface with 115200,8n1.
Now boot the Wandboard and press any key to interrupt U-Boot. Enter the following command (without backslashes and newlines!)
setenv bootargs console=ttymxc0,115200 \
                root=/dev/mmcblk0p1 \
                video=mxcfb0:dev=hdmi,1920x1080@60 \
                rw rootwait
saveenv
run bootcmd

Stage3

Login to your stage3 installation with your host's root passwd. From now on you're installing Gentoo like on any other device (Without a new kernel!)
Have fun!