@@ -1,53 +1,48 | |||
|
1 | 1 | # |
|
2 | 2 | # Debootstrap basic system |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | VARIANT="" |
|
9 | 9 | COMPONENTS="main" |
|
10 | 10 | EXCLUDES="" |
|
11 | 11 | |
|
12 | 12 | # Use non-free Debian packages if needed |
|
13 | 13 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
14 | 14 | COMPONENTS="main,non-free" |
|
15 | 15 | fi |
|
16 | 16 | |
|
17 | 17 | # Use minbase bootstrap variant which only includes essential packages |
|
18 | 18 | if [ "$ENABLE_MINBASE" = true ] ; then |
|
19 | 19 | VARIANT="--variant=minbase" |
|
20 | 20 | fi |
|
21 | 21 | |
|
22 | 22 | # Exclude packages if required by Debian release |
|
23 | if [ "$RELEASE" = "stretch" ] ; then | |
|
24 | EXCLUDES="--exclude=init,systemd-sysv" | |
|
25 | fi | |
|
26 | ||
|
27 | # Exclude packages if required by Debian buster release | |
|
28 | if [ "$RELEASE" = "buster" ] ; then | |
|
23 | if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
29 | 24 | EXCLUDES="--exclude=init,systemd-sysv" |
|
30 | 25 | fi |
|
31 | 26 | |
|
32 | 27 | # Base debootstrap (unpack only) |
|
33 | 28 | http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" |
|
34 | 29 | |
|
35 | 30 | # Copy qemu emulator binary to chroot modified for changes in _apt management in buster |
|
36 | 31 | #install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
|
37 | 32 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
|
38 | 33 | |
|
39 | 34 | # Copy debian-archive-keyring.pgp |
|
40 | 35 | mkdir -p "${R}/usr/share/keyrings" |
|
41 | 36 | install_readonly /usr/share/keyrings/debian-archive-keyring.gpg "${R}/usr/share/keyrings/debian-archive-keyring.gpg" |
|
42 | 37 | |
|
43 | 38 | # Complete the bootstrapping process |
|
44 | 39 | chroot_exec /debootstrap/debootstrap --second-stage |
|
45 | 40 | |
|
46 | 41 | # Mount required filesystems |
|
47 | 42 | mount -t proc none "${R}/proc" |
|
48 | 43 | mount -t sysfs none "${R}/sys" |
|
49 | 44 | |
|
50 | 45 | # Mount pseudo terminal slave if supported by Debian release |
|
51 | 46 | if [ -d "${R}/dev/pts" ] ; then |
|
52 | 47 | mount --bind /dev/pts "${R}/dev/pts" |
|
53 | 48 | fi |
@@ -1,54 +1,49 | |||
|
1 | 1 | # |
|
2 | 2 | # Build and Setup fbturbo Xorg driver |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$ENABLE_FBTURBO" = true ] ; then |
|
9 | 9 | # Install c/c++ build environment inside the chroot |
|
10 | 10 | chroot_install_cc |
|
11 | 11 | |
|
12 | 12 | # Copy existing fbturbo sources into chroot directory |
|
13 | 13 | if [ -n "$FBTURBOSRC_DIR" ] && [ -d "$FBTURBOSRC_DIR" ] ; then |
|
14 | 14 | # Copy local fbturbo sources |
|
15 | 15 | cp -r "${FBTURBOSRC_DIR}" "${R}/tmp" |
|
16 | 16 | else |
|
17 | 17 | # Create temporary directory for fbturbo sources |
|
18 | 18 | temp_dir=$(sudo -u nobody mktemp -d) |
|
19 | 19 | |
|
20 | 20 | # Fetch fbturbo sources |
|
21 | 21 | sudo -u nobody git -C "${temp_dir}" clone "${FBTURBO_URL}" |
|
22 | 22 | |
|
23 | 23 | # Move downloaded fbturbo sources |
|
24 | 24 | mv "${temp_dir}/xf86-video-fbturbo" "${R}/tmp/" |
|
25 | 25 | |
|
26 | 26 | # Remove temporary directory for fbturbo sources |
|
27 | 27 | rm -fr "${temp_dir}" |
|
28 | 28 | fi |
|
29 | 29 | |
|
30 | 30 | # Install Xorg build dependencies |
|
31 | if [ "$RELEASE" = "jessie" ] ; then | |
|
32 | chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |
|
33 | elif [ "$RELEASE" = "stretch" ] ; then | |
|
34 | chroot_exec apt-get -q -y --no-install-recommends --allow-unauthenticated install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |
|
35 | # removed --allow-unauthenticated as recommended after amendment on _apt privileges | |
|
36 | elif [ "$RELEASE" = "buster" ] ; then | |
|
31 | if [ "$RELEASE" = "jessie" ] || [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
37 | 32 | chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev |
|
38 | 33 | fi |
|
39 | 34 | |
|
40 | 35 | # Build and install fbturbo driver inside chroot |
|
41 | 36 | chroot_exec /bin/bash -x <<'EOF' |
|
42 | 37 | cd /tmp/xf86-video-fbturbo |
|
43 | 38 | autoreconf -vi |
|
44 | 39 | ./configure --prefix=/usr |
|
45 | 40 | make |
|
46 | 41 | make install |
|
47 | 42 | EOF |
|
48 | 43 | |
|
49 | 44 | # Install fbturbo driver Xorg configuration |
|
50 | 45 | install_readonly files/xorg/99-fbturbo.conf "${R}/usr/share/X11/xorg.conf.d/99-fbturbo.conf" |
|
51 | 46 | |
|
52 | 47 | # Remove Xorg build dependencies |
|
53 | 48 | chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev |
|
54 | 49 | fi |
@@ -1,76 +1,74 | |||
|
1 | 1 | # This file contains utility functions used by rpi23-gen-image.sh |
|
2 | 2 | |
|
3 | 3 | cleanup (){ |
|
4 | 4 | set +x |
|
5 | 5 | set +e |
|
6 | 6 | |
|
7 | 7 | # Identify and kill all processes still using files |
|
8 | 8 | echo "killing processes using mount point ..." |
|
9 | 9 | fuser -k "${R}" |
|
10 | 10 | sleep 3 |
|
11 | 11 | fuser -9 -k -v "${R}" |
|
12 | 12 | |
|
13 | 13 | # Clean up temporary .password file |
|
14 | 14 | if [ -r ".password" ] ; then |
|
15 | 15 | shred -zu .password |
|
16 | 16 | fi |
|
17 | 17 | |
|
18 | 18 | # Clean up all temporary mount points |
|
19 | 19 | echo "removing temporary mount points ..." |
|
20 | 20 | umount -l "${R}/proc" 2> /dev/null |
|
21 | 21 | umount -l "${R}/sys" 2> /dev/null |
|
22 | 22 | umount -l "${R}/dev/pts" 2> /dev/null |
|
23 | 23 | umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null |
|
24 | 24 | umount "$BUILDDIR/mount" 2> /dev/null |
|
25 | 25 | cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null |
|
26 | 26 | losetup -d "$ROOT_LOOP" 2> /dev/null |
|
27 | 27 | losetup -d "$FRMW_LOOP" 2> /dev/null |
|
28 | 28 | trap - 0 1 2 3 6 |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | chroot_exec() { |
|
32 | 32 | # Exec command in chroot |
|
33 | 33 | LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $* |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | install_readonly() { |
|
37 | 37 | # Install file with user read-only permissions |
|
38 | 38 | install -o root -g root -m 644 $* |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | install_exec() { |
|
42 | 42 | # Install file with root exec permissions |
|
43 | 43 | install -o root -g root -m 744 $* |
|
44 | 44 | } |
|
45 | 45 | |
|
46 | 46 | use_template () { |
|
47 | 47 | # Test if configuration template file exists |
|
48 | 48 | if [ ! -r "./templates/${CONFIG_TEMPLATE}" ] ; then |
|
49 | 49 | echo "error: configuration template ${CONFIG_TEMPLATE} not found" |
|
50 | 50 | exit 1 |
|
51 | 51 | fi |
|
52 | 52 | |
|
53 | 53 | # Load template configuration parameters |
|
54 | 54 | . "./templates/${CONFIG_TEMPLATE}" |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | chroot_install_cc() { |
|
58 | 58 | # Install c/c++ build environment inside the chroot |
|
59 | 59 | if [ -z "${COMPILER_PACKAGES}" ] ; then |
|
60 | 60 | COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }') |
|
61 | 61 | |
|
62 | if [ "$RELEASE" = "jessie" ] ; then | |
|
62 | if [ "$RELEASE" = "jessie" ] || [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
63 | 63 | chroot_exec apt-get -q -y --no-install-recommends install ${COMPILER_PACKAGES} |
|
64 | elif [ "$RELEASE" = "stretch" ] ; then | |
|
65 | chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install ${COMPILER_PACKAGES} | |
|
66 | 64 | fi |
|
67 | 65 | fi |
|
68 | 66 | } |
|
69 | 67 | |
|
70 | 68 | chroot_remove_cc() { |
|
71 | 69 | # Remove c/c++ build environment from the chroot |
|
72 | 70 | if [ ! -z "${COMPILER_PACKAGES}" ] ; then |
|
73 | 71 | chroot_exec apt-get -qq -y --auto-remove purge ${COMPILER_PACKAGES} |
|
74 | 72 | COMPILER_PACKAGES="" |
|
75 | 73 | fi |
|
76 | 74 | } |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant