-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_rootfs_and_kernel
executable file
·68 lines (52 loc) · 2.3 KB
/
create_rootfs_and_kernel
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash -e
# Copyright (C) 2018 Gunter Miegel coinboot.io
#
# This file is part of Coinboot.
#
# Coinboot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The Kernel to use is set by the environment variable DEBIRF_KERNEL
# Don't mix this up with DEBIRF_KERNEL_PACKAGE which defines a locally available
# Debian package to be used.
#export DEBIRF_KERNEL=4.4.0-133-generic
apt update
apt install --yes debirf bc sudo
# We have a customized version of debirf
# with an adapted 'init' script able to
# pull and extract plugins.
cp /mnt/debirf /usr/bin/debirf
# Lets replace single threaded gzip
# with pgiz that can use multiple cores.
# Also set some symlink to use it as
# drop-in-replacment.
apt install --yes pigz lbzip2 pbzip2
ln -fs /usr/bin/lbzip2 /usr/local/bin/bzip2
ln -fs /usr/bin/lbzip2 /usr/local/bin/bunzip2
ln -fs /usr/bin/lbzip2 /usr/local/bin/bzcat
ln -fs /usr/bin/pigz /usr/local/bin/gzip
ln -fs /usr/bin/pigz /usr/local/bin/gunzip
ln -fs /usr/bin/pigz /usr/local/bin/zcat
# FIXME: Setting variant=minbase shrink the rootfs archive by ~10M, but access over network and serial fails.
# sudo sed -i 's#eval "/usr/sbin/debootstrap $OPTS"#eval "/usr/sbin/debootstrap --variant=minbase $OPTS"#' $(which debirf)
# debootstrap can not handle that /vagrant is mounted with noexec or nodev
# so we copy the debirf profile to /tmp
cp -vr /mnt/profiles/coinboot /tmp
# export variables of the debirf profile
source /mnt/profiles/coinboot/debirf.conf
which debirf
ls -la /tmp
#Force a root build without fakeroot
time debirf make -n --root-build --no-warning /tmp/coinboot
sudo cp -v /tmp/coinboot/vmlinuz* /mnt/build/coinboot-vmlinuz-$DEBIRF_KERNEL
sudo cp -v /tmp/coinboot/*.cgz /mnt/build/coinboot-initramfs-$DEBIRF_KERNEL
sudo chmod -v 644 /mnt/build/*