Monday, November 28, 2011

ARMHFP Builders Via Chroot

Recently our Buildfarm http://arm.koji.fedoraproject.org has been upgraded to include ARMV7HL builder support. This was achieved by creating a Fedora 15 Arm chroot on our Pandaboards.

Here are the steps taken:

Prep - Download the completed rootfs, and chrootfs:
RootFS: http://iraq.proximity.on.ca/v7chroot/PANDABOARD/rootfs.tar.gz
Boot: http://iraq.proximity.on.ca/PANDA/boot.tar.gz
ChrootFS: http://iraq.proximity.on.ca/v7chroot/PANDABOARD/v7chroot-final-certless.tgz
MakePandaScript: http://iraq.proximity.on.ca/PANDA/makepanda

Steps for PandaMainroot
1) run the makepanda script on your SDcard, this will create the necessary partition scheme. This should be complete, at this point.

2) Mount the boot partition and explode the boot tarball to it.

mkdir tmpmnt
mount /dev/carddev1 tmpmnt/
tar xfv boot.tar.gz -C tmpmnt/
sync
umount tmpmnt/

3) Follow the same process for the rootfs

mount /dev/carddev2 tmpmnt/
tar xfv rootfs.tar.gz -C tmpmnt/
sync
umount tmpmnt/

4) Place the card in the panda and power it on, if you make it to the login prompt your good to go, login with password fedoraarm.

Note: That you will have to manually setup your networking, as this is currently done via a script in the rootfs, and will not work outside of our farm, some custom tweaking will be necessary . The chroot will still function just fine for building V7HL with mock, provided you have the correct mock config in place. ping fossjon in #fedora-arm for more info.

Steps for Chroot Creation
1) Install the rootfs onto your pandaboard

2) Explode chroot archive into rootfs like so

tar xfvj v7chroot-final-certless.tgz -C /

3) Copy Main root resolv.conf to chroot
Note: This is done to ensure the chroot has DNS info, the ip will be shared via main rootfs

cp /etc/resolv.conf /path/too/chroot/etc/resolv.conf

4) Test connectivity with: ping yahoo.ca

5) Add the following(6,7) to the main rootfs /etc/rc.d/init.d/koji-config
Note: The koji-config is a script executed at boot time to prep and enable the pandaboard in our build environment, it is native to our set up, yours may differ.

6) Setup bind Mounts from Local root to Chroot

mount -t proc   chroot_proc   /home/v7chroot/root/proc
mount -t sysfs  chroot_sysfs  /home/v7chroot/root/sys
mount -t devpts -o gid=5,mode=0620,ptmxmode=0666,newinstance chroot_devpts /home/v7chroot/root/dev/pts
mount -t tmpfs chroot_shmfs /home/v7chroot/root/dev/shm
mount --bind /var/cache/mock/fedora-15-arm/ccache/ /home/v7chroot/root/tmp/ccache
mount --bind /mnt/koji /home/v7chroot/root/mnt/koji
mount --bind /fs0 /home/v7chroot/root/fs0
mount -o bind /dev/ /home/v7chroot/root/dev

7) Change Kojid config in chroot to the correct hostname for user= and create the correct sym link to the kojid cert for the builder
Note: This step is only necessary for a fedora-arm koji setup, it can be ignored if builder will not  be included in koji.
 
sed -i "s/^user *=.*$/user = $(hostname)-v7hl/" /home/v7chroot/root/etc/kojid/kojid.conf

ln -s /etc/kojid/certs/$(hostname)-v7hl.pem /etc/kojid/localhost.pem

8) Start the Chroot

chroot /home/v7chroot/root

9) You can setup in a startup script a command to start the chroot, and kojid within like so: chroot /home/v7chroot/root/ /sbin/service/ kojid start &

10) Finally, if you wish to have your panda as part of the build effort, ping aeboccia,fossjon,frojoe,ctyler in #fedora-arm on Freenode IRC