-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-chroot.sh
44 lines (34 loc) · 1.09 KB
/
build-chroot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Based on a test script from avsm/ocaml repo https://github.com/avsm/ocaml
CHROOT_DIR=/tmp/arm-chroot
TARBALL="${CHROOT_DIR}.tar.bz2"
MIRROR=http://archive.raspbian.org/raspbian
VERSION=wheezy
CHROOT_ARCH=armhf
# Debian package dependencies for the host
HOST_DEPENDENCIES="debootstrap qemu-user-static binfmt-support sbuild"
function setup_chroot {
# Host dependencies
sudo apt-get update
sudo apt-get install -qq -y ${HOST_DEPENDENCIES}
# Create chrooted environment
sudo mkdir ${CHROOT_DIR}
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential \
--arch=${CHROOT_ARCH} ${VERSION} ${CHROOT_DIR} ${MIRROR}
sudo cp /usr/bin/qemu-arm-static ${CHROOT_DIR}/usr/bin/
sudo chroot ${CHROOT_DIR} ./debootstrap/debootstrap --second-stage
sudo sbuild-createchroot --arch=${CHROOT_ARCH} --foreign --setup-only \
${VERSION} ${CHROOT_DIR} ${MIRROR}
sudo chroot ${CHROOT_DIR} apt-get update
}
function package_chroot {
sudo tar -cjf $TARBALL $CHROOT_DIR
sudo chown $USER $TARBALL
}
function test_chroot {
# TODO
echo "TODO"
}
setup_chroot
test_chroot
package_chroot