Skip to content

Commit 9e4d176

Browse files
authored
Merge pull request #3 from ThomasKaiser/master
Add preliminary Debian Stretch multistrapping
2 parents 2a0c1ac + 5dde29a commit 9e4d176

File tree

3 files changed

+83
-5
lines changed

3 files changed

+83
-5
lines changed

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export LINUX_BRANCH ?= my-hacks-1.2
44
export BOOT_TOOLS_BRANCH ?= master
55
LINUX_LOCALVERSION ?= -ayufan-$(RELEASE)
66

7-
all: xenial-pinebook
7+
all: linux-pinebook
88

99
linux/.git:
1010
git clone --depth=1 --branch=$(LINUX_BRANCH) --single-branch \
@@ -112,6 +112,16 @@ xenial-i3-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pinebo
112112
pinebook \
113113
i3
114114

115+
stretch-i3-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img: simple-image-pinebook-$(RELEASE_NAME).img.xz linux-pine64-$(RELEASE_NAME).tar.xz linux-pine64-package-$(RELEASE_NAME).deb boot-tools
116+
sudo bash ./build-pine64-image.sh \
117+
$(shell readlink -f $@) \
118+
$(shell readlink -f simple-image-pinebook-$(RELEASE_NAME).img.xz) \
119+
$(shell readlink -f linux-pine64-$(RELEASE_NAME).tar.xz) \
120+
$(shell readlink -f linux-pine64-package-$(RELEASE_NAME).deb) \
121+
stretch \
122+
pinebook \
123+
i3
124+
115125
.PHONY: kernel-tarball
116126
kernel-tarball: linux-pine64-$(RELEASE_NAME).tar.xz
117127

@@ -130,5 +140,11 @@ xenial-mate-pinebook: xenial-mate-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).
130140
.PHONY: xenial-i3-pinebook
131141
xenial-i3-pinebook: xenial-i3-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img.xz
132142

143+
.PHONY: stretch-i3-pinebook
144+
stretch-i3-pinebook: stretch-i3-pinebook-bspkernel-$(RELEASE_NAME)-$(RELEASE).img.xz
145+
133146
.PHONY: xenial-pinebook
134147
xenial-pinebook: xenial-minimal-pinebook xenial-mate-pinebook xenial-i3-pinebook
148+
149+
.PHONY: linux-pinebook
150+
linux-pinebook: xenial-minimal-pinebook xenial-mate-pinebook xenial-i3-pinebook stretch-i3-pinebook

build-environment/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt-get install -y python git-core gnupg flex bison gperf build-essential \
99
dosfstools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
1010
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi ccache \
1111
sudo cpio nano vim kmod kpartx wget bsdtar qemu-user-static \
12-
pxz ruby-dev
12+
pxz ruby-dev debootstrap multistrap
1313

1414
RUN gem install fpm
1515

simpleimage/make_rootfs.sh

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ case $DISTRO in
8383
ROOTFS="${DISTRO}-base-arm64.tar.gz"
8484
METHOD="debootstrap"
8585
;;
86+
stretch)
87+
ROOTFS="${DISTRO}-base-arm64.tar.gz"
88+
METHOD="multistrap"
89+
;;
8690
*)
8791
echo "Unknown distribution: $DISTRO"
8892
exit 1
@@ -106,8 +110,6 @@ deboostrap_rootfs() {
106110
bsdtar --include ./usr/share/keyrings/$KR --strip-components 4 -xvf "$DATA"
107111
rm -f "$DATA"
108112

109-
apt-get -y install debootstrap qemu-user-static
110-
111113
qemu-debootstrap --arch=arm64 --keyring=$TEMP/$KR $dist rootfs http://httpredir.debian.org/debian
112114
rm -f $KR
113115

@@ -120,6 +122,44 @@ deboostrap_rootfs() {
120122
cd -
121123
}
122124

125+
multistrap_rootfs() {
126+
dist="$1"
127+
tgz="$(readlink -f "$2")"
128+
129+
[ "$TEMP" ] || exit 1
130+
cd $TEMP && pwd
131+
132+
cat > multistrap.conf <<EOF
133+
[General]
134+
noauth=true
135+
unpack=true
136+
debootstrap=Debian Net
137+
aptsources=Debian
138+
139+
[Debian]
140+
# Base packages
141+
packages=systemd systemd-sysv udev apt kmod locales sudo
142+
source=http://deb.debian.org/debian/
143+
keyring=debian-archive-keyring
144+
components=main non-free
145+
suite=stretch
146+
147+
[Net]
148+
# Networking packages
149+
packages=netbase net-tools ethtool iproute iputils-ping ifupdown dhcpcd5 firmware-brcm80211 wpasupplicant ssh avahi-daemon ntp wireless-tools
150+
EOF
151+
152+
multistrap -a arm64 -d rootfs -f multistrap.conf
153+
154+
# keeping things clean as this is copied later again
155+
rm -f rootfs/usr/bin/qemu-aarch64-static
156+
157+
bsdtar -C $TEMP/rootfs -a -cf $tgz .
158+
rm -fr $TEMP/rootfs
159+
160+
cd -
161+
}
162+
123163
mkdir -p $BUILD
124164
TARBALL="$BUILD/$(basename $ROOTFS)"
125165
mkdir -p "$BUILD"
@@ -129,6 +169,8 @@ if [ ! -e "$TARBALL" ]; then
129169
wget -O "$TARBALL" "$ROOTFS"
130170
elif [ "$METHOD" = "debootstrap" ]; then
131171
deboostrap_rootfs "$DISTRO" "$TARBALL"
172+
elif [ "$METHOD" = "multistrap" ]; then
173+
multistrap_rootfs "$DISTRO" "$TARBALL"
132174
else
133175
echo "Unknown rootfs creation method"
134176
exit 1
@@ -177,6 +219,19 @@ deb http://security.debian.org/ ${release}/updates main contrib non-free
177219
EOF
178220
}
179221

222+
add_stretch_apt_sources() {
223+
local release="$1"
224+
local aptsrcfile="$DEST/etc/apt/sources.list"
225+
cat > "$aptsrcfile" <<EOF
226+
deb http://deb.debian.org/debian stretch main contrib non-free
227+
deb-src http://deb.debian.org/debian stretch main contrib non-free
228+
deb http://deb.debian.org/debian stretch-updates main contrib non-free
229+
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free
230+
deb http://security.debian.org/ stretch/updates main contrib non-free
231+
deb-src http://security.debian.org/ stretch/updates main contrib non-free
232+
EOF
233+
}
234+
180235
add_ubuntu_apt_sources() {
181236
local release="$1"
182237
cat > "$DEST/etc/apt/sources.list" <<EOF
@@ -205,7 +260,7 @@ case $DISTRO in
205260
echo "No longer supported"
206261
exit 1
207262
;;
208-
xenial|sid|jessie)
263+
xenial|sid|jessie|stretch)
209264
rm "$DEST/etc/resolv.conf"
210265
cp /etc/resolv.conf "$DEST/etc/resolv.conf"
211266
if [ "$DISTRO" = "xenial" ]; then
@@ -222,6 +277,13 @@ case $DISTRO in
222277
EXTRADEBS="sudo"
223278
ADDPPACMD=
224279
DISPTOOLCMD=
280+
elif [ "$DISTRO" = "stretch" ]; then
281+
DEB=stretch
282+
DEBUSER=debian
283+
DEBUSERPW=debian
284+
EXTRADEBS="sudo"
285+
ADDPPACMD=
286+
DISPTOOLCMD=
225287
else
226288
echo "Unknown DISTRO=$DISTRO"
227289
exit 2

0 commit comments

Comments
 (0)