This commit is contained in:
root 2020-02-28 10:24:56 -07:00
commit 865a99cbdb
8 changed files with 61 additions and 27 deletions

View File

@ -41,7 +41,7 @@ COMPRESSOR_THREADS=2
all: $(SCRIPTS)
clean:
rm -v *.sh
-rm -f *.sh
distdir-$(DATECODE):
mkdir -p distdir-$(DATECODE)

View File

@ -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.

View File

@ -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"

View File

@ -485,8 +485,15 @@ menu_partitions() {
if [ $? -eq 0 ]; then
local device=$(cat $ANSWER)
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}cfdisk will be executed in disk $device.${RESET}\n\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
@ -500,13 +507,14 @@ ${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
clear; $software $device; PARTITIONS_DONE=1
break
done
else
return
fi
fi
fi
}
menu_keymap() {

View File

@ -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() {
@ -237,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
}
@ -263,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

View File

@ -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
@ -165,6 +165,17 @@ if [ "$BOOT_FSTYPE" = "vfat" ]; then
_args="-I -F16"
fi
BOOT_START=2048
ROOT_START=
case "$PLATFORM" in
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
cubieboard2|cubietruck|ci20*|odroid-c2*)
# These platforms use a single partition for the entire filesystem.
@ -184,8 +195,8 @@ _EOF
# layout for new platforms.
sfdisk "${FILENAME}" <<_EOF
label: dos
2048,${BOOT_FSSIZE},b,*
,+,L
${BOOT_START},${BOOT_FSSIZE},b,*
${ROOT_START},+,L
_EOF
LOOPDEV=$(losetup --show --find --partscan "$FILENAME")
# Normally we need to quote to prevent argument splitting, but
@ -247,6 +258,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
@ -278,6 +293,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

View File

@ -51,7 +51,7 @@ Usage: $PROGNAME [options] <platform> <base-tarball>
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 <syspkg> Set an alternative base-system package (defaults to base-system)
@ -61,6 +61,7 @@ Options
-C <file> Full path to the XBPS configuration file
-r <repo> Set XBPS repository (may be set multiple times)
-x <num> Use <num> threads to compress the image (dynamic if unset)
-o <file> 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,15 +75,16 @@ _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" ;;
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" ;;
h) usage; exit 0 ;;
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0 ;;
@ -125,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
@ -222,7 +225,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

View File

@ -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