Skip to content

Instantly share code, notes, and snippets.

@keo
Created January 2, 2016 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keo/72eacdabc7350ced3d5c to your computer and use it in GitHub Desktop.
Save keo/72eacdabc7350ced3d5c to your computer and use it in GitHub Desktop.
Setting up gitian build environment for ARM
# download Ubuntu Server 14.04 from http://forum.odroid.com/viewtopic.php?f=95&t=15261
# wget ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz
docker run --name gitian_builder --privileged -ti debian:jessie bash
# inside the VM / docker container
apt-get update && apt-get upgrade -y
apt-get install -y qemu qemu-user-static binfmt-support wget xz-utils parted
# download minimal Debian Jessie from http://forum.odroid.com/viewtopic.php?f=96&t=17542
wget -O- http://oph.mdrjr.net/meveric/images/Jessie/Debian-Jessie-1.0~RC2-20151123-XU3.img.xz | xz -d - >jessie.img
dd if=/dev/zero bs=1M count=1024 >>jessie.img
fdisk -lu jessie.img
losetup -f --show jessie.img
losetup -f --show -o $((147456*512)) jessie.img
parted /dev/loop0
## inside parted:
# unit s
# print
## take note of start of 2nd partition (147456s for me)
# rm 2
# mkpart primary 147456s -1s
# unit compact
# print
## should show a ~1.5 GB second partition
# quit
e2fsck -f /dev/loop1
resize2fs /dev/loop1
losetup -d /dev/loop0 /dev/loop1
# mount it on the host
# 147456 was the start sector of the second partition shown by parted
mkdir /jessie_mnt
mount jessie.img -o loop,offset=$((147456*512)),rw /jessie_mnt
# To get everything to work (e.g., network) you need to comment out everything in /jessie_mnt/etc/ld.so.preload before chrooting in. Take care of that now!
cd /jessie_mnt
mount --bind /dev dev/
mount --bind /sys sys/
mount --bind /proc proc/
mount --bind /dev/pts dev/pts
cp /usr/bin/qemu-arm-static usr/bin/
chroot . /bin/bash
# should be in armv7l chroot
Linux server 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 armv7l GNU/Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment