From 95e305c4611705838d35773ac6404caa80b40400 Mon Sep 17 00:00:00 2001 From: toluschr Date: Wed, 4 Sep 2019 14:54:02 +0200 Subject: [PATCH 01/12] Added possibility to choose the partitioning software --- installer.sh.in | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index b16f525..b76680c 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -485,8 +485,15 @@ menu_partitions() { if [ $? -eq 0 ]; then local device=$(cat $ANSWER) - DIALOG --title "Modify Partition Table on $device" --msgbox "\n -${BOLD}cfdisk will be executed in disk $device.${RESET}\n\n + DIALOG --title " Select the software for partitioning " \ + --menu "$MENULABEL" ${MENUSIZE} \ + "cfdisk" "Easy to use" \ + "fdisk" "More advanced" + if [ $? -eq 0 ]; then + local software=$(cat $ANSWER) + + DIALOG --title "Modify Partition Table on $device" --msgbox "\n +${BOLD}${software} will be executed in disk $device.${RESET}\n\n For BIOS systems, MBR or GPT partition tables are supported.\n To use GPT on PC BIOS systems an empty partition of 1MB must be added\n at the first 2GB of the disk with the TOGGLE \`bios_grub' enabled.\n @@ -498,13 +505,14 @@ At least 1 partition is required for the rootfs (/).\n For swap, RAM*2 must be really enough. For / 600MB are required.\n\n ${BOLD}WARNING: /usr is not supported as a separate partition.${RESET}\n ${RESET}\n" 18 80 - if [ $? -eq 0 ]; then - while true; do - clear; cfdisk $device; PARTITIONS_DONE=1 - break - done - else - return + if [ $? -eq 0 ]; then + while true; do + clear; $software $device; PARTITIONS_DONE=1 + break + done + else + return + fi fi fi } From 4ffa689706005bb73373a29c8023257a899ead74 Mon Sep 17 00:00:00 2001 From: Piraty Date: Wed, 18 Dec 2019 15:27:35 +0100 Subject: [PATCH 02/12] mkimage.sh.in: explicitly set 'PermitRootLogin yes' in sshd_config So far, image generation relied on the config shipped in the openssh package to ensure root login with password, but as this might change in the future, explicitly apply and document this requirement for embedded images here instead. The exception for GCP (disable root login) should still work as intended. --- mkimage.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkimage.sh.in b/mkimage.sh.in index 7b0aab4..495757c 100644 --- a/mkimage.sh.in +++ b/mkimage.sh.in @@ -247,6 +247,10 @@ if [ -n "$BOOT_UUID" ]; then echo "UUID=$BOOT_UUID /boot $BOOT_FSTYPE defaults${fstab_args} 0 2" >> "${ROOTFS}/etc/fstab" fi +# Images are shipped with root as the only user by default, so we need to +# ensure ssh login is possible for headless setups. +sed -i "${ROOTFS}/etc/ssh/sshd_config" -e 's|^#\(PermitRootLogin\) .*|\1 yes|g' + # This section does final configuration on the images. In the case of # SBCs this writes the bootloader to the image or sets up other # required binaries to boot. In the case of images destined for a From 3c12c74de08f8c1fd4925aec00cf4e8716a69e02 Mon Sep 17 00:00:00 2001 From: Adam Gausmann Date: Fri, 14 Feb 2020 12:23:37 -0600 Subject: [PATCH 03/12] Add -o to mkplatformfs.sh for feature parity --- mkplatformfs.sh.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 69fbc92..9653daa 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -61,6 +61,7 @@ Options -C Full path to the XBPS configuration file -r Set XBPS repository (may be set multiple times) -x Use threads to compress the image (dynamic if unset) + -o Filename to write the PLATFORMFS archive to -n Do not compress the image, instead print out the rootfs directory -h Show this help -V Show version @@ -74,7 +75,7 @@ _EOF BASEPKG=base-system COMPRESSION="y" -while getopts "b:p:k:c:C:r:x:nhV" opt; do +while getopts "b:p:k:c:C:r:x:o:nhV" opt; do case $opt in b) BASEPKG="$OPTARG" ;; p) EXTRA_PKGS="$OPTARG" ;; @@ -83,6 +84,7 @@ while getopts "b:p:k:c:C:r:x:nhV" opt; do C) XBPS_CONFFILE="-C $OPTARG" ;; r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG" ;; x) COMPRESSOR_THREADS="$OPTARG" ;; + o) FILENAME="$OPTARG" ;; n) COMPRESSION="n" ;; h) usage; exit 0 ;; V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0 ;; @@ -222,7 +224,7 @@ fi if [ "$COMPRESSION" = "y" ]; then # Finally we can compress the tarball, the name will include the # platform and the date on which the tarball was built. - tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz + tarball=${FILENAME:-void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz} run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball " # Now that we have the tarball we don't need the rootfs anymore, so we From 2b1aa4f45dadaa9514d9e16d2361b2311c88d8db Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Mon, 17 Feb 2020 20:37:54 +0100 Subject: [PATCH 04/12] lib: make sure /tmp is there and mount it --- lib.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib.sh.in b/lib.sh.in index a108190..f50a60c 100644 --- a/lib.sh.in +++ b/lib.sh.in @@ -58,6 +58,10 @@ mount_pseudofs() { mount -r --bind /$f "$ROOTFS/$f" fi done + if ! mountpoint -q "$ROOTFS/tmp" ; then + mkdir -p "$ROOTFS/tmp" + mount -o mode=0755,nosuid,nodev -t tmpfs tmpfs "$ROOTFS/tmp" + fi } umount_pseudofs() { @@ -71,6 +75,7 @@ umount_pseudofs() { umount -f "$ROOTFS/$f" >/dev/null 2>&1 done fi + umount -f "$ROOTFS/tmp" >/dev/null 2>&1 } run_cmd_target() { From cc93f013b0e49506eff03cd8c07453ee0bef474a Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Wed, 19 Feb 2020 19:04:16 -0800 Subject: [PATCH 05/12] Prefer repositories from '-r' in mkplatformfs This allows replacing existing packages with custom built ones and makes mkplatformfs behavior consistent with mkrootfs. --- mkplatformfs.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 9653daa..44d7a06 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -82,7 +82,7 @@ while getopts "b:p:k:c:C:r:x:o:nhV" opt; do k) POST_CMD="$OPTARG" ;; c) XBPS_CACHEDIR="--cachedir=$OPTARG" ;; C) XBPS_CONFFILE="-C $OPTARG" ;; - r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG" ;; + r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY" ;; x) COMPRESSOR_THREADS="$OPTARG" ;; o) FILENAME="$OPTARG" ;; n) COMPRESSION="n" ;; From 9b0805471a222b506145340e5aa898f55ef9c45f Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Sun, 26 Jan 2020 08:58:38 -0800 Subject: [PATCH 06/12] Add support for Pinebook Pro (pinebookpro) --- lib.sh.in | 1 + mkimage.sh.in | 8 +++++++- mkplatformfs.sh.in | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib.sh.in b/lib.sh.in index f50a60c..29471d6 100644 --- a/lib.sh.in +++ b/lib.sh.in @@ -268,6 +268,7 @@ set_target_arch_from_platform() { i686*) XBPS_TARGET_ARCH="i686";; x86_64*) XBPS_TARGET_ARCH="x86_64";; GCP*) XBPS_TARGET_ARCH="x86_64";; + pinebookpro*) XBPS_TARGET_ARCH="aarch64";; *) die "$PROGNAME: Unable to compute target architecture from platform";; esac diff --git a/mkimage.sh.in b/mkimage.sh.in index 495757c..aebfd1b 100644 --- a/mkimage.sh.in +++ b/mkimage.sh.in @@ -143,7 +143,7 @@ fi # Be absolutely certain the platform is supported before continuing case "$PLATFORM" in - bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|usbarmory|GCP|*-musl);; + bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|usbarmory|GCP|pinebookpro|*-musl);; *) die "The $PLATFORM is not supported, exiting..." esac @@ -282,6 +282,12 @@ ci20*) dd if="${ROOTFS}/boot/u-boot-spl.bin" of="${LOOPDEV}" obs=512 seek=1 >/dev/null 2>&1 dd if="${ROOTFS}/boot/u-boot.img" of="${LOOPDEV}" obs=1K seek=14 >/dev/null 2>&1 ;; +pinebookpro*) + dd if="${ROOTFS}/boot/idbloader.img" of="${LOOPDEV}" seek=64 conv=notrunc,fsync >/dev/null 2>&1 + dd if="${ROOTFS}/boot/u-boot.itb" of="${LOOPDEV}" seek=16384 conv=notrunc,fsync >/dev/null 2>&1 + run_cmd_chroot "${ROOTFS}" "xbps-reconfigure -f pinebookpro-kernel" + cleanup_chroot + ;; GCP*) # Google Cloud Platform image configuration for Google Cloud # Engine. The steps below are built in reference to the diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 44d7a06..af98eb4 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -51,7 +51,7 @@ Usage: $PROGNAME [options] Supported platforms: i686, x86_64, GCP, dockstar, bananapi, beaglebone, cubieboard2, cubietruck, odroid-c2, odroid-u2, rpi, rpi2 (armv7), rpi3 (aarch64), - usbarmory, ci20, pogoplugv4 + usbarmory, ci20, pogoplugv4, pinebookpro Options -b Set an alternative base-system package (defaults to base-system) @@ -127,6 +127,7 @@ case "$PLATFORM" in i686*) PKGS="$BASEPKG" ;; x86_64*) PKGS="$BASEPKG" ;; GCP*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;; + pinebookpro*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;; *) die "$PROGNAME: invalid platform!";; esac From a7a20d50d34872d35968b6d9126972e5a7e2287a Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Thu, 20 Feb 2020 05:54:13 -0800 Subject: [PATCH 07/12] Fix execution of post install scripts on cross builds Add missing call to register_binfmt before installing packages on mkrootfs. --- lib.sh.in | 2 +- mkrootfs.sh.in | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib.sh.in b/lib.sh.in index 29471d6..55cb73b 100644 --- a/lib.sh.in +++ b/lib.sh.in @@ -242,7 +242,7 @@ register_binfmt() { # use the static one always and make sure it shows up at the same # place in the host and the chroot. if [ ! -x "$ROOTFS/usr/bin/$QEMU_BIN" ] ; then - cp -f "$(which "$QEMU_BIN")" "$ROOTFS/usr/bin" || + install -m755 -D "$(which "$QEMU_BIN")" "$ROOTFS/usr/bin/$QEMU_BIN" || die "Could not install $QEMU_BIN to $ROOTFS/usr/bin/" fi } diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in index 93b9f94..8353a94 100644 --- a/mkrootfs.sh.in +++ b/mkrootfs.sh.in @@ -136,8 +136,10 @@ run_cmd_target "xbps-install -S $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY - # so we set this here. chmod 755 "$ROOTFS" -# The pseudofs mountpoints are needed for the qemu support in cases -# where we are running things that aren't natively executable. +# The binfmt setup and pseudofs mountpoints are needed for the qemu +# support in cases where we are running things that aren't natively +# executable. +register_binfmt mount_pseudofs # With everything setup, we can now run the install to load the From 4861b7619de748e9b9d6e62aed59c680cc1bba71 Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Fri, 21 Feb 2020 19:25:31 -0800 Subject: [PATCH 08/12] Increase partitions shift on pinebookpro Create boot partition starting at 32768 sectors on pinebookpro platforms. That leaves enough unallocated space to install u-boot without overlapping with any partition. --- mkimage.sh.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mkimage.sh.in b/mkimage.sh.in index aebfd1b..27a9fc5 100644 --- a/mkimage.sh.in +++ b/mkimage.sh.in @@ -165,6 +165,11 @@ if [ "$BOOT_FSTYPE" = "vfat" ]; then _args="-I -F16" fi +BOOT_START=2048 +case "$PLATFORM" in + pinebookpro*) BOOT_START=32768 ;; +esac + case "$PLATFORM" in cubieboard2|cubietruck|ci20*|odroid-c2*) # These platforms use a single partition for the entire filesystem. @@ -184,8 +189,8 @@ _EOF # layout for new platforms. sfdisk "${FILENAME}" <<_EOF label: dos -2048,${BOOT_FSSIZE},b,* -,+,L +${BOOT_START},${BOOT_FSSIZE},b,* ++${BOOT_FSSIZE},+,L _EOF LOOPDEV=$(losetup --show --find --partscan "$FILENAME") # Normally we need to quote to prevent argument splitting, but From 707943982ba299c5720f7d7065d00c1ab0fd01da Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Mon, 24 Feb 2020 22:36:40 -0800 Subject: [PATCH 09/12] Only set root partition start on pinebookpro --- mkimage.sh.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mkimage.sh.in b/mkimage.sh.in index 27a9fc5..a995728 100644 --- a/mkimage.sh.in +++ b/mkimage.sh.in @@ -166,8 +166,14 @@ if [ "$BOOT_FSTYPE" = "vfat" ]; then fi BOOT_START=2048 +ROOT_START= case "$PLATFORM" in - pinebookpro*) BOOT_START=32768 ;; + pinebookpro*) + BOOT_START=32768 + # Without this, sfdisk creates root partition starting at + # 2048, overlapping u-boot reserved space and boot partition. + ROOT_START=$BOOT_START + ;; esac case "$PLATFORM" in @@ -190,7 +196,7 @@ _EOF sfdisk "${FILENAME}" <<_EOF label: dos ${BOOT_START},${BOOT_FSSIZE},b,* -+${BOOT_FSSIZE},+,L +${ROOT_START},+,L _EOF LOOPDEV=$(losetup --show --find --partscan "$FILENAME") # Normally we need to quote to prevent argument splitting, but From 529c48e54aa9844cc868ab50806a448704d45b38 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 27 Feb 2020 11:39:33 +0100 Subject: [PATCH 10/12] Makefile: fix the clean target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index debacde..c8f1f68 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ COMPRESSOR_THREADS=2 all: $(SCRIPTS) clean: - rm -v *.sh + -rm -f *.sh distdir-$(DATECODE): mkdir -p distdir-$(DATECODE) From 557be33ae7f9f25c50b6a521268c7dd534b21012 Mon Sep 17 00:00:00 2001 From: Piraty Date: Sun, 27 Oct 2019 20:02:04 +0100 Subject: [PATCH 11/12] build-x86-images.sh: remove intel-ucode from X_PKGS intel-ucode went to nonfree repository with void-packages/450dd113fbb87e9299161bb7143536249ecb16c2 It makes more sense in permanent installations anyway --- build-x86-images.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 6f08673..2626a13 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -29,7 +29,7 @@ readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso readonly GRUB="grub-i386-efi grub-x86_64-efi" readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm $GRUB" -readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio intel-ucode" +readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio" readonly E_PKGS="$X_PKGS lxdm enlightenment terminology econnman udisks2 firefox-esr" readonly XFCE_PKGS="$X_PKGS lxdm xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr" readonly MATE_PKGS="$X_PKGS lxdm mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr" From d2969a770840bcb4983754620d679b82062f53be Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 27 Feb 2020 11:48:08 +0100 Subject: [PATCH 12/12] README.md: the scripts are not in flux, remove obsolete comment. --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index fb6c540..5423c41 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,3 @@ Build an x86\_64 musl live image with packages stored in a local repository: # ./mklive.sh -a x86_64-musl -r /path/to/host/binpkgs See the usage output for more information :-) - - -These scripts are in flux, if you want to build a duplicate of a -production image, its not a bad idea to ping maldridge on IRC. This -message will be removed when this readme is replaced with complete -documentation.