#!/bin/sh # this script needs linaro-image-tools and kpartx installed #simple version #wget -N http://releases.linaro.org/13.08/ubuntu/vexpress/hwpack_linaro-vexpress_20130826-443_armhf_supported.tar.gz #wget -N http://releases.linaro.org/13.08/ubuntu/${suite}-images/nano/linaro-${suite}-nano-20130826-474.tar.gz #wget -N http://snapshots.linaro.org/components/platform/xen/latest/xen set -e sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install --no-install-recommends -y kpartx u-boot-tools wget linaro-image-tools parted curl gdisk libc6:i386 libstdc++6:i386 zlib1g:i386 bc build-essential qemu-user-static linaro-image-tools python-pycurl python-beautifulsoup python-html2text python-xdg python-debian pixz if [ -n "$1" -a -n "$2" ]; then export hwpack="$1" export FILES="$2" else echo "usage: $0 " exit 1 fi case $hwpack in mustang) echo "Mustang uses nfs" ${FILES}/makelavanfs $hwpack $FILES ${FILES}/jenkins/kernelbuild exit $? ;; arndale) ${FILES}/jenkins/kernelbuild ;; midway) echo "skip midway kernel" ;; *) echo "Unknown hwpack $hwpack" exit 1 ;; esac image="xenlava-${hwpack}.img" suite="vivid" case $hwpack in midway) echo "trying release" HWPACK_BUILD_FILENAME="hwpack_linaro-midway_20140417-630_armhf_supported.tar.gz" HWPACK_BUILD_URL="http://releases.linaro.org/14.04/ubuntu/midway/hwpack_linaro-midway_20140417-630_armhf_supported.tar.gz" wget -nc --progress=dot -e dotbytes=2M ${HWPACK_BUILD_URL} # hack to use utopic - riku 12.06 rm -rf tmp mkdir tmp (cd tmp tar xzf ../${HWPACK_BUILD_FILENAME} sed -i -e "s,saucy,${suite},g" sources.list.d/* rm -rf pkgs/linux-base* rm -rf pkgs/*perl* grep -v libuuid-perl manifest > m; mv m manifest cd pkgs; dpkg-scanpackages . /dev/null > Packages; cd .. tar czf ../${HWPACK_BUILD_FILENAME} * ) rm -rf tmp ;; arndale) echo "use local build" export HWPACK_BUILD_FILENAME="hwpack*_armhf_supported.tar.gz" ;; esac set -e #get last rootfs that built OK export ROOTFS_BUILD_NUMBER=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/ubuntu-armhf-rootfs/label=build,rootfs=nano-lava/lastSuccessfulBuild/buildNumber` export ROOTFS_BUILD_TIMESTAMP=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/ubuntu-armhf-rootfs/label=build,rootfs=nano-lava/lastSuccessfulBuild/buildTimestamp?format=yyyyMMdd` export ROOTFS_BUILD_FILENAME="linaro-${suite}-nano-lava-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.tar.gz" export ROOTFS_BUILD_URL="http://snapshots.linaro.org/ubuntu/images/nano-lava/${ROOTFS_BUILD_NUMBER}/${ROOTFS_BUILD_FILENAME}" wget -N --progress=dot -e dotbytes=2M ${ROOTFS_BUILD_URL} if [ $? -ne 0 ]; then echo "rootfs download failed" exit 1 fi #get xen hypervisor and tools export XEN_BUILD_NUMBER=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/xen-packages/label=docker-utopic-armhf/lastSuccessfulBuild/buildNumber` wget -N --progress=dot -e dotbytes=2M "http://snapshots.linaro.org/components/platform/xen/${XEN_BUILD_NUMBER}/armhf/xen-armhf" if [ $? -ne 0 ]; then echo "Can't download xen binary" exit 1 fi wget -N --progress=dot -e dotbytes=2M "http://snapshots.linaro.org/components/platform/xen/${XEN_BUILD_NUMBER}/armhf/xen-armhf.deb" if [ $? -ne 0 ]; then echo "Can't download xen-armhf deb" exit 1 fi case $hwpack in midway) dev=highbank ;; *) dev=${hwpack} ;; esac BOOTMOUNT=bootfs MOUNT=rootfs sudo rm -rf ${image} ${image}.gz $MOUNT $BOOTMOUNT #make a suitable image from the standard hwpack+nano rootfs sudo linaro-media-create --hwpack-force-yes --dev ${dev} --image-file xenlava-${hwpack}.img \ --hwpack ${HWPACK_BUILD_FILENAME} --binary ${ROOTFS_BUILD_FILENAME} \ --image-size 3G --bootloader u_boot #loopmount partitions sudo kpartx -s -a -v ${image} case $hwpack in arndale) BOOT=/dev/mapper/loop*p2 ROOTFS=/dev/mapper/loop*p3 ;; midway) BOOT=/dev/mapper/loop*p1 ROOTFS=/dev/mapper/loop*p2 dev=highbank ;; esac #add the hypervisor to the boot image mkdir $MOUNT $BOOTMOUNT sudo mount $BOOT $BOOTMOUNT sudo mount $ROOTFS $MOUNT # midway uses a u-boot script for booting, we use our own script with xen stuff case $hwpack in midway) sudo chmod a+r $BOOTMOUNT/boot.txt UUID=`tr ' ' '\n' < $BOOTMOUNT/boot.txt |sed -n /UUID/s/.*=//p` sed -e "s/%%UUID%%/$UUID/" ${FILES}/files/midway-boot.txt > /tmp/boot.txt mkimage -A arm -T script -C none -n "xen lava" -d /tmp/boot.txt /tmp/boot.scr sudo cp /tmp/boot.txt /tmp/boot.scr $BOOTMOUNT cat /tmp/boot.txt sudo cp $MOUNT/boot/vmlinuz*midway $BOOTMOUNT/zImage ;; arndale) sudo rm -f ${MOUNT}/etc/init/auto-serial-console.conf ;; esac sudo cp xen-armhf $BOOTMOUNT/xen #add hvc0 init file and xen tools package to the rootfs image sudo cp ${FILES}/files/hvc0.conf ${MOUNT}/etc/init/ sudo cp ${FILES}/files/linaro-repo.list ${MOUNT}/etc/apt/sources.list.d/ sudo dpkg-deb --extract xen-armhf.deb $MOUNT sudo touch ${MOUNT}/etc/resolv.conf sudo umount $MOUNT sudo umount $BOOTMOUNT #tidy up mapper devices sudo kpartx -d ${image} #compress the image time pixz ${image}