mklive, mkiso: support aarch64
This commit is contained in:
parent
41ccf5e202
commit
a78af02a01
|
@ -14,3 +14,4 @@ distdir-*/
|
||||||
release/
|
release/
|
||||||
packer/cloud-*/
|
packer/cloud-*/
|
||||||
packer/vagrant-*/
|
packer/vagrant-*/
|
||||||
|
mklive-build*/
|
||||||
|
|
|
@ -2,6 +2,17 @@
|
||||||
set pager="1"
|
set pager="1"
|
||||||
set locale_dir="(${voidlive})/boot/grub/locale"
|
set locale_dir="(${voidlive})/boot/grub/locale"
|
||||||
|
|
||||||
|
if [ "${grub_cpu}" == "x86_64" ]; then
|
||||||
|
set kernel_img="vmlinuz"
|
||||||
|
set memtest="yes"
|
||||||
|
elif [ "${grub_cpu}" == "i386" ]; then
|
||||||
|
set kernel_img="vmlinuz"
|
||||||
|
set memtest="yes"
|
||||||
|
elif [ "${grub_cpu}" == "arm64" ]; then
|
||||||
|
set kernel_img="vmlinux"
|
||||||
|
set memtest=""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e "${prefix}/${grub_cpu}-${grub_platform}/all_video.mod" ]; then
|
if [ -e "${prefix}/${grub_cpu}-${grub_platform}/all_video.mod" ]; then
|
||||||
insmod all_video
|
insmod all_video
|
||||||
else
|
else
|
||||||
|
@ -35,7 +46,7 @@ play 600 988 1 1319 4
|
||||||
if [ cpuid -l ]; then
|
if [ cpuid -l ]; then
|
||||||
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@)" --id "linux" {
|
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@)" --id "linux" {
|
||||||
set gfxpayload="keep"
|
set gfxpayload="keep"
|
||||||
linux (${voidlive})/boot/vmlinuz \
|
linux (${voidlive})/boot/${kernel_img} \
|
||||||
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
||||||
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
||||||
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
||||||
|
@ -44,7 +55,7 @@ if [ cpuid -l ]; then
|
||||||
}
|
}
|
||||||
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (RAM)" --id "linuxram" {
|
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (RAM)" --id "linuxram" {
|
||||||
set gfxpayload="keep"
|
set gfxpayload="keep"
|
||||||
linux (${voidlive})/boot/vmlinuz \
|
linux (${voidlive})/boot/${kernel_img} \
|
||||||
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
||||||
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
||||||
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
||||||
|
@ -62,7 +73,7 @@ if [ cpuid -l ]; then
|
||||||
}
|
}
|
||||||
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech" --hotkey s --id "linuxa11y" {
|
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech" --hotkey s --id "linuxa11y" {
|
||||||
set gfxpayload="keep"
|
set gfxpayload="keep"
|
||||||
linux (${voidlive})/boot/vmlinuz \
|
linux (${voidlive})/boot/${kernel_img} \
|
||||||
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
||||||
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
||||||
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
||||||
|
@ -71,7 +82,7 @@ if [ cpuid -l ]; then
|
||||||
}
|
}
|
||||||
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech (RAM)" --hotkey r --id "linuxa11yram" {
|
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech (RAM)" --hotkey r --id "linuxa11yram" {
|
||||||
set gfxpayload="keep"
|
set gfxpayload="keep"
|
||||||
linux (${voidlive})/boot/vmlinuz \
|
linux (${voidlive})/boot/${kernel_img} \
|
||||||
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
|
||||||
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
||||||
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
|
||||||
|
@ -87,19 +98,21 @@ if [ cpuid -l ]; then
|
||||||
locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin nomodeset
|
locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin nomodeset
|
||||||
initrd (${voidlive})/boot/initrd
|
initrd (${voidlive})/boot/initrd
|
||||||
}
|
}
|
||||||
if [ "${grub_platform}" == "efi" ]; then
|
if [ "${memtest}" == "yes" ]; then
|
||||||
menuentry "Run Memtest86+ (RAM test)" --hotkey m --id memtest {
|
if [ "${grub_platform}" == "efi" ]; then
|
||||||
set gfxpayload="keep"
|
menuentry "Run Memtest86+ (RAM test)" --id memtest {
|
||||||
linux (${voidlive})/boot/memtest.efi
|
set gfxpayload="keep"
|
||||||
}
|
linux (${voidlive})/boot/memtest.efi
|
||||||
menuentry 'UEFI Firmware Settings' --hotkey f --id uefifw {
|
}
|
||||||
fwsetup
|
menuentry 'UEFI Firmware Settings' --id uefifw {
|
||||||
}
|
fwsetup
|
||||||
else
|
}
|
||||||
menuentry "Run Memtest86+ (RAM test)" --id memtest {
|
else
|
||||||
set gfxpayload="keep"
|
menuentry "Run Memtest86+ (RAM test)" --id memtest {
|
||||||
linux (${voidlive})/boot/memtest.bin
|
set gfxpayload="keep"
|
||||||
}
|
linux (${voidlive})/boot/memtest.bin
|
||||||
|
}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
menuentry "System restart" --hotkey b --id restart {
|
menuentry "System restart" --hotkey b --id restart {
|
||||||
|
|
5
mkiso.sh
5
mkiso.sh
|
@ -72,7 +72,10 @@ build_variant() {
|
||||||
variant="$1"
|
variant="$1"
|
||||||
shift
|
shift
|
||||||
IMG=void-live-${ARCH}-${DATE}-${variant}.iso
|
IMG=void-live-${ARCH}-${DATE}-${variant}.iso
|
||||||
GRUB_PKGS="grub-i386-efi grub-x86_64-efi"
|
case "$ARCH" in
|
||||||
|
x86_64*|i686*) GRUB_PKGS="grub-i386-efi grub-x86_64-efi" ;;
|
||||||
|
aarch64*) GRUB_PKGS="grub-arm64-efi" ;;
|
||||||
|
esac
|
||||||
A11Y_PKGS="espeakup void-live-audio brltty"
|
A11Y_PKGS="espeakup void-live-audio brltty"
|
||||||
PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror chrony tmux $A11Y_PKGS $GRUB_PKGS"
|
PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror chrony tmux $A11Y_PKGS $GRUB_PKGS"
|
||||||
XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca"
|
XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca"
|
||||||
|
|
251
mklive.sh
251
mklive.sh
|
@ -28,9 +28,12 @@ umask 022
|
||||||
|
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
||||||
readonly REQUIRED_PKGS="base-files libgcc dash coreutils sed tar gawk syslinux grub-i386-efi grub-x86_64-efi memtest86+ squashfs-tools xorriso"
|
REQUIRED_PKGS=(base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso)
|
||||||
readonly INITRAMFS_PKGS="binutils xz device-mapper dhclient dracut-network openresolv"
|
TARGET_PKGS=(base-files)
|
||||||
readonly PROGNAME=$(basename "$0")
|
INITRAMFS_PKGS=(binutils xz device-mapper dhclient dracut-network openresolv)
|
||||||
|
PACKAGE_LIST=()
|
||||||
|
IGNORE_PKGS=()
|
||||||
|
readonly PROGNAME="$(basename "$0")"
|
||||||
declare -a INCLUDE_DIRS=()
|
declare -a INCLUDE_DIRS=()
|
||||||
|
|
||||||
info_msg() {
|
info_msg() {
|
||||||
|
@ -117,8 +120,14 @@ copy_autoinstaller_files() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_prereqs() {
|
install_prereqs() {
|
||||||
XBPS_ARCH=$ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \
|
XBPS_ARCH=$HOST_ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \
|
||||||
-c "$XBPS_HOST_CACHEDIR" -y $REQUIRED_PKGS
|
-c "$XBPS_HOST_CACHEDIR" -y "${REQUIRED_PKGS[@]}"
|
||||||
|
[ $? -ne 0 ] && die "Failed to install required software, exiting..."
|
||||||
|
}
|
||||||
|
|
||||||
|
install_target_pkgs() {
|
||||||
|
XBPS_ARCH=$TARGET_ARCH "$XBPS_INSTALL_CMD" -r "$VOIDTARGETDIR" ${XBPS_REPOSITORY} \
|
||||||
|
-c "$XBPS_HOST_CACHEDIR" -y "${TARGET_PKGS[@]}"
|
||||||
[ $? -ne 0 ] && die "Failed to install required software, exiting..."
|
[ $? -ne 0 ] && die "Failed to install required software, exiting..."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,15 +143,15 @@ post_install_packages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \
|
XBPS_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \
|
||||||
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn $PACKAGE_LIST $INITRAMFS_PKGS
|
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn "${PACKAGE_LIST[@]}" "${INITRAMFS_PKGS[@]}"
|
||||||
[ $? -ne 0 ] && die "Missing required binary packages, exiting..."
|
[ $? -ne 0 ] && die "Missing required binary packages, exiting..."
|
||||||
|
|
||||||
mount_pseudofs
|
mount_pseudofs
|
||||||
|
|
||||||
LANG=C XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \
|
LANG=C XBPS_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \
|
||||||
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y $PACKAGE_LIST $INITRAMFS_PKGS
|
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y "${PACKAGE_LIST[@]}" "${INITRAMFS_PKGS[@]}"
|
||||||
[ $? -ne 0 ] && die "Failed to install $PACKAGE_LIST"
|
[ $? -ne 0 ] && die "Failed to install ${PACKAGE_LIST[*]}"
|
||||||
|
|
||||||
xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1
|
xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1
|
||||||
chroot "$ROOTFS" env -i xbps-reconfigure -f base-files
|
chroot "$ROOTFS" env -i xbps-reconfigure -f base-files
|
||||||
|
@ -163,7 +172,7 @@ install_packages() {
|
||||||
|
|
||||||
ignore_packages() {
|
ignore_packages() {
|
||||||
mkdir -p "$ROOTFS"/etc/xbps.d
|
mkdir -p "$ROOTFS"/etc/xbps.d
|
||||||
for pkg in $IGNORE_PKGS; do
|
for pkg in "${IGNORE_PKGS[@]}"; do
|
||||||
echo "ignorepkg=$pkg" >> "$ROOTFS"/etc/xbps.d/mklive-ignore.conf
|
echo "ignorepkg=$pkg" >> "$ROOTFS"/etc/xbps.d/mklive-ignore.conf
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -200,11 +209,14 @@ generate_initramfs() {
|
||||||
[ $? -ne 0 ] && die "Failed to generate the initramfs"
|
[ $? -ne 0 ] && die "Failed to generate the initramfs"
|
||||||
|
|
||||||
mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
|
mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
|
||||||
cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz
|
case "$TARGET_ARCH" in
|
||||||
|
i686*|x86_64*) cp "$ROOTFS/boot/vmlinuz-$KERNELVERSION" "$BOOT_DIR"/vmlinuz ;;
|
||||||
|
aarch64*) cp "$ROOTFS/boot/vmlinux-$KERNELVERSION" "$BOOT_DIR"/vmlinux ;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_rootfs() {
|
cleanup_rootfs() {
|
||||||
for f in ${INITRAMFS_PKGS}; do
|
for f in "${INITRAMFS_PKGS[@]}"; do
|
||||||
revdeps=$(xbps-query -r "$ROOTFS" -X $f)
|
revdeps=$(xbps-query -r "$ROOTFS" -X $f)
|
||||||
if [ -n "$revdeps" ]; then
|
if [ -n "$revdeps" ]; then
|
||||||
xbps-pkgdb -r "$ROOTFS" -m auto $f
|
xbps-pkgdb -r "$ROOTFS" -m auto $f
|
||||||
|
@ -231,23 +243,27 @@ generate_isolinux_boot() {
|
||||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
||||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||||
-e "s|@@ARCH@@|$BASE_ARCH|" \
|
-e "s|@@ARCH@@|$TARGET_ARCH|" \
|
||||||
-e "s|@@LOCALE@@|${LOCALE}|" \
|
-e "s|@@LOCALE@@|${LOCALE}|" \
|
||||||
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
||||||
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
||||||
"$ISOLINUX_DIR"/isolinux.cfg
|
"$ISOLINUX_DIR"/isolinux.cfg
|
||||||
|
|
||||||
# include memtest86+
|
# include memtest86+
|
||||||
cp -f "$VOIDHOSTDIR"/boot/memtest86+/memtest.bin "$BOOT_DIR"
|
if [ -e "$VOIDTARGETDIR"/boot/memtest86+/memtest.bin ]; then
|
||||||
|
cp "$VOIDTARGETDIR"/boot/memtest86+/memtest.bin "$BOOT_DIR"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_grub_efi_boot() {
|
generate_grub_efi_boot() {
|
||||||
|
set -x
|
||||||
cp -f grub/grub.cfg "$GRUB_DIR"
|
cp -f grub/grub.cfg "$GRUB_DIR"
|
||||||
|
cp -f "${SPLASH_IMAGE}" "$ISOLINUX_DIR"
|
||||||
cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
|
cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
|
||||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
||||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||||
-e "s|@@ARCH@@|$BASE_ARCH|" \
|
-e "s|@@ARCH@@|$TARGET_ARCH|" \
|
||||||
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
||||||
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
||||||
-e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
|
-e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
|
||||||
|
@ -260,40 +276,45 @@ generate_grub_efi_boot() {
|
||||||
truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
|
truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
|
||||||
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
|
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
|
||||||
|
|
||||||
GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)"
|
GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$BUILDDIR" -dt grub-efi.XXXXX)"
|
||||||
LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
|
LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
|
||||||
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
|
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
|
||||||
|
|
||||||
cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR"
|
build_grub_image() {
|
||||||
xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
|
local GRUB_ARCH="$1" EFI_ARCH="$2"
|
||||||
--directory="/usr/lib/grub/i386-efi" \
|
xbps-uchroot "$VOIDTARGETDIR" grub-mkstandalone -- \
|
||||||
--format="i386-efi" \
|
--directory="/usr/lib/grub/${GRUB_ARCH}-efi" \
|
||||||
--output="/tmp/bootia32.efi" \
|
--format="${GRUB_ARCH}-efi" \
|
||||||
"boot/grub/grub.cfg"
|
--output="/tmp/boot${EFI_ARCH,,}.efi" \
|
||||||
if [ $? -ne 0 ]; then
|
"boot/grub/grub.cfg"
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
if [ $? -ne 0 ]; then
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
die "Failed to generate EFI loader"
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
fi
|
die "Failed to generate EFI loader"
|
||||||
mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
|
fi
|
||||||
cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI
|
mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
|
||||||
xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
|
cp -f "$VOIDTARGETDIR/tmp/boot${EFI_ARCH,,}.efi" "${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOT${EFI_ARCH^^}.EFI"
|
||||||
--directory="/usr/lib/grub/x86_64-efi" \
|
}
|
||||||
--format="x86_64-efi" \
|
|
||||||
--output="/tmp/bootx64.efi" \
|
cp -a "$IMAGEDIR"/boot "$VOIDTARGETDIR"
|
||||||
"boot/grub/grub.cfg"
|
|
||||||
if [ $? -ne 0 ]; then
|
case "$TARGET_ARCH" in
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
i686*|x86_64*)
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
# XXX: why are both built on both arches?
|
||||||
die "Failed to generate EFI loader"
|
build_grub_image i386 ia32
|
||||||
fi
|
build_grub_image x86_64 x64
|
||||||
cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI
|
# include memtest86+
|
||||||
|
if [ -e "$VOIDTARGETDIR"/boot/memtest86+/memtest.efi ]; then
|
||||||
|
cp "$VOIDTARGETDIR"/boot/memtest86+/memtest.efi "$BOOT_DIR"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
aarch64*)
|
||||||
|
build_grub_image arm64 aa64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
rm -rf "$GRUB_EFI_TMPDIR"
|
rm -rf "$GRUB_EFI_TMPDIR"
|
||||||
|
|
||||||
# include memtest86+
|
|
||||||
cp -f "$VOIDHOSTDIR"/boot/memtest86+/memtest.efi "$BOOT_DIR"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_squashfs() {
|
generate_squashfs() {
|
||||||
|
@ -320,17 +341,47 @@ generate_squashfs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_iso_image() {
|
generate_iso_image() {
|
||||||
"$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \
|
local bootloader n
|
||||||
-iso-level 3 -rock -joliet \
|
XORRISO_ARGS=(
|
||||||
-max-iso9660-filenames -omit-period \
|
-iso-level 3 -rock -joliet -joliet-long -max-iso9660-filenames -omit-period
|
||||||
-omit-version-number -relaxed-filenames -allow-lowercase \
|
-omit-version-number -relaxed-filenames -allow-lowercase
|
||||||
-volid "VOID_LIVE" \
|
-volid VOID_LIVE
|
||||||
-eltorito-boot boot/isolinux/isolinux.bin \
|
)
|
||||||
-eltorito-catalog boot/isolinux/boot.cat \
|
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
if [ "$IMAGE_TYPE" = hybrid ]; then
|
||||||
-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
|
XORRISO_ARGS+=(-isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin)
|
||||||
-isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \
|
fi
|
||||||
-output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image"
|
|
||||||
|
n=1
|
||||||
|
for bootloader in "${BOOTLOADERS[@]}"; do
|
||||||
|
if (( n > 1 )); then
|
||||||
|
XORRISO_ARGS+=(-eltorito-alt-boot)
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${bootloader}" in
|
||||||
|
grub)
|
||||||
|
XORRISO_ARGS+=(
|
||||||
|
-e boot/grub/efiboot.img -no-emul-boot
|
||||||
|
-isohybrid-gpt-basdat -isohybrid-apm-hfsplus
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
syslinux)
|
||||||
|
XORRISO_ARGS+=(
|
||||||
|
-eltorito-boot boot/isolinux/isolinux.bin
|
||||||
|
-eltorito-catalog boot/isolinux/boot.cat
|
||||||
|
-no-emul-boot -boot-load-size 4 -boot-info-table
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
n=$(( n + 1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
XORRISO_ARGS+=(
|
||||||
|
-output "$OUTPUT_FILE" "$IMAGEDIR"
|
||||||
|
)
|
||||||
|
|
||||||
|
"$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs "${XORRISO_ARGS[@]}" || die "Failed to generate ISO image"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -338,11 +389,11 @@ generate_iso_image() {
|
||||||
#
|
#
|
||||||
while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do
|
while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
a) BASE_ARCH="$OPTARG";;
|
a) TARGET_ARCH="$OPTARG";;
|
||||||
b) BASE_SYSTEM_PKG="$OPTARG";;
|
b) BASE_SYSTEM_PKG="$OPTARG";;
|
||||||
r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
|
r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
|
||||||
c) XBPS_CACHEDIR="$OPTARG";;
|
c) XBPS_CACHEDIR="$OPTARG";;
|
||||||
g) IGNORE_PKGS="$IGNORE_PKGS $OPTARG" ;;
|
g) IGNORE_PKGS+=($OPTARG) ;;
|
||||||
K) readonly KEEP_BUILDDIR=1;;
|
K) readonly KEEP_BUILDDIR=1;;
|
||||||
k) KEYMAP="$OPTARG";;
|
k) KEYMAP="$OPTARG";;
|
||||||
l) LOCALE="$OPTARG";;
|
l) LOCALE="$OPTARG";;
|
||||||
|
@ -352,7 +403,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do
|
||||||
e) ROOT_SHELL="$OPTARG";;
|
e) ROOT_SHELL="$OPTARG";;
|
||||||
s) SQUASHFS_COMPRESSION="$OPTARG";;
|
s) SQUASHFS_COMPRESSION="$OPTARG";;
|
||||||
o) OUTPUT_FILE="$OPTARG";;
|
o) OUTPUT_FILE="$OPTARG";;
|
||||||
p) PACKAGE_LIST="$PACKAGE_LIST $OPTARG";;
|
p) PACKAGE_LIST+=($OPTARG);;
|
||||||
C) BOOT_CMDLINE="$OPTARG";;
|
C) BOOT_CMDLINE="$OPTARG";;
|
||||||
T) BOOT_TITLE="$OPTARG";;
|
T) BOOT_TITLE="$OPTARG";;
|
||||||
v) LINUX_VERSION="$OPTARG";;
|
v) LINUX_VERSION="$OPTARG";;
|
||||||
|
@ -362,17 +413,17 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl"
|
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl --repository=https://repo-default.voidlinux.org/current/aarch64"
|
||||||
|
|
||||||
# Configure dracut to use overlayfs for the writable overlay.
|
# Configure dracut to use overlayfs for the writable overlay.
|
||||||
BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
|
BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
|
||||||
|
|
||||||
ARCH=$(xbps-uhelper arch)
|
HOST_ARCH=$(xbps-uhelper arch)
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
: ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
|
: ${TARGET_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
|
||||||
: ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}}
|
: ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${TARGET_ARCH}}
|
||||||
: ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}}
|
: ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${HOST_ARCH}}
|
||||||
: ${KEYMAP:=us}
|
: ${KEYMAP:=us}
|
||||||
: ${LOCALE:=en_US.UTF-8}
|
: ${LOCALE:=en_US.UTF-8}
|
||||||
: ${INITRAMFS_COMPRESSION:=xz}
|
: ${INITRAMFS_COMPRESSION:=xz}
|
||||||
|
@ -381,13 +432,22 @@ ARCH=$(xbps-uhelper arch)
|
||||||
: ${BOOT_TITLE:="Void Linux"}
|
: ${BOOT_TITLE:="Void Linux"}
|
||||||
: ${LINUX_VERSION:=linux}
|
: ${LINUX_VERSION:=linux}
|
||||||
|
|
||||||
case $BASE_ARCH in
|
case "$TARGET_ARCH" in
|
||||||
x86_64*|i686*) ;;
|
x86_64*|i686*)
|
||||||
*) >&2 echo architecture $BASE_ARCH not supported by mklive.sh; exit 1;;
|
BOOTLOADERS=(syslinux grub)
|
||||||
|
IMAGE_TYPE='hybrid'
|
||||||
|
TARGET_PKGS+=(syslinux grub-i386-efi grub-x86_64-efi memtest86+)
|
||||||
|
;;
|
||||||
|
aarch64*)
|
||||||
|
BOOTLOADERS=(grub)
|
||||||
|
IMAGE_TYPE='efi'
|
||||||
|
TARGET_PKGS+=(grub-arm64-efi)
|
||||||
|
;;
|
||||||
|
*) >&2 echo "architecture $TARGET_ARCH not supported by mklive.sh"; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Required packages in the image for a working system.
|
# Required packages in the image for a working system.
|
||||||
PACKAGE_LIST="$BASE_SYSTEM_PKG $PACKAGE_LIST"
|
PACKAGE_LIST+=("$BASE_SYSTEM_PKG")
|
||||||
|
|
||||||
# Check for root permissions.
|
# Check for root permissions.
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
@ -397,25 +457,27 @@ fi
|
||||||
trap 'error_out $? $LINENO' INT TERM 0
|
trap 'error_out $? $LINENO' INT TERM 0
|
||||||
|
|
||||||
if [ -n "$ROOTDIR" ]; then
|
if [ -n "$ROOTDIR" ]; then
|
||||||
BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
|
BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -dt mklive-build.XXXXX)
|
||||||
else
|
else
|
||||||
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
|
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -dt mklive-build.XXXXX)
|
||||||
fi
|
fi
|
||||||
BUILDDIR=$(readlink -f "$BUILDDIR")
|
BUILDDIR=$(readlink -f "$BUILDDIR")
|
||||||
IMAGEDIR="$BUILDDIR/image"
|
IMAGEDIR="$BUILDDIR/image"
|
||||||
ROOTFS="$IMAGEDIR/rootfs"
|
ROOTFS="$IMAGEDIR/rootfs"
|
||||||
VOIDHOSTDIR="$BUILDDIR/void-host"
|
VOIDHOSTDIR="$BUILDDIR/void-host"
|
||||||
|
VOIDTARGETDIR="$BUILDDIR/void-target"
|
||||||
BOOT_DIR="$IMAGEDIR/boot"
|
BOOT_DIR="$IMAGEDIR/boot"
|
||||||
ISOLINUX_DIR="$BOOT_DIR/isolinux"
|
ISOLINUX_DIR="$BOOT_DIR/isolinux"
|
||||||
GRUB_DIR="$BOOT_DIR/grub"
|
GRUB_DIR="$BOOT_DIR/grub"
|
||||||
CURRENT_STEP=0
|
CURRENT_STEP=0
|
||||||
STEP_COUNT=10
|
STEP_COUNT=10
|
||||||
|
[ "${IMAGE_TYPE}" = hybrid ] && STEP_COUNT=$((STEP_COUNT+1))
|
||||||
[ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
|
[ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
|
||||||
[ -n "${IGNORE_PKGS}" ] && STEP_COUNT=$((STEP_COUNT+1))
|
[ "${#IGNORE_PKGS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
|
||||||
[ -n "$ROOT_SHELL" ] && STEP_COUNT=$((STEP_COUNT+1))
|
[ -n "$ROOT_SHELL" ] && STEP_COUNT=$((STEP_COUNT+1))
|
||||||
|
|
||||||
: ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux}
|
: ${SYSLINUX_DATADIR:="$VOIDTARGETDIR"/usr/lib/syslinux}
|
||||||
: ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
|
: ${GRUB_DATADIR:="$VOIDTARGETDIR"/usr/share/grub}
|
||||||
: ${SPLASH_IMAGE:=data/splash.png}
|
: ${SPLASH_IMAGE:=data/splash.png}
|
||||||
: ${XBPS_INSTALL_CMD:=xbps-install}
|
: ${XBPS_INSTALL_CMD:=xbps-install}
|
||||||
: ${XBPS_REMOVE_CMD:=xbps-remove}
|
: ${XBPS_REMOVE_CMD:=xbps-remove}
|
||||||
|
@ -424,30 +486,32 @@ STEP_COUNT=10
|
||||||
: ${XBPS_UHELPER_CMD:=xbps-uhelper}
|
: ${XBPS_UHELPER_CMD:=xbps-uhelper}
|
||||||
: ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
|
: ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
|
||||||
|
|
||||||
mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR"
|
mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$VOIDTARGETDIR" "$GRUB_DIR" "$ISOLINUX_DIR"
|
||||||
|
|
||||||
print_step "Synchronizing XBPS repository data..."
|
print_step "Synchronizing XBPS repository data..."
|
||||||
copy_void_keys "$ROOTFS"
|
copy_void_keys "$ROOTFS"
|
||||||
|
XBPS_ARCH=$TARGET_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
|
||||||
copy_void_keys "$VOIDHOSTDIR"
|
copy_void_keys "$VOIDHOSTDIR"
|
||||||
XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
|
XBPS_ARCH=$HOST_ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
|
||||||
XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
|
copy_void_keys "$VOIDTARGETDIR"
|
||||||
|
XBPS_ARCH=$TARGET_ARCH $XBPS_INSTALL_CMD -r "$VOIDTARGETDIR" ${XBPS_REPOSITORY} -S
|
||||||
|
|
||||||
# Get linux version for ISO
|
# Get linux version for ISO
|
||||||
# If linux version option specified use
|
# If linux version option specified use
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
case "$LINUX_VERSION" in
|
case "$LINUX_VERSION" in
|
||||||
linux+([0-9.]))
|
linux+([0-9.]))
|
||||||
IGNORE_PKGS+=" linux"
|
IGNORE_PKGS+=(linux)
|
||||||
PACKAGE_LIST+=" $LINUX_VERSION linux-base"
|
PACKAGE_LIST+=("$LINUX_VERSION" linux-base)
|
||||||
;;
|
;;
|
||||||
linux-@(mainline|lts))
|
linux-@(mainline|lts))
|
||||||
IGNORE_PKGS+=" linux"
|
IGNORE_PKGS+=(linux)
|
||||||
PACKAGE_LIST+=" $LINUX_VERSION"
|
PACKAGE_LIST+=("$LINUX_VERSION")
|
||||||
LINUX_VERSION="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x "$LINUX_VERSION" | grep 'linux[0-9._]\+')"
|
LINUX_VERSION="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x "$LINUX_VERSION" | grep 'linux[0-9._]\+')"
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
PACKAGE_LIST+=" linux"
|
PACKAGE_LIST+=(linux)
|
||||||
LINUX_VERSION="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')"
|
LINUX_VERSION="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "-v option must be in format linux<version> or linux-<series>"
|
die "-v option must be in format linux<version> or linux-<series>"
|
||||||
|
@ -455,28 +519,31 @@ case "$LINUX_VERSION" in
|
||||||
esac
|
esac
|
||||||
shopt -u extglob
|
shopt -u extglob
|
||||||
|
|
||||||
_kver="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver $LINUX_VERSION)"
|
_kver="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver $LINUX_VERSION)"
|
||||||
KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
|
KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
|
||||||
|
|
||||||
if [ "$?" -ne "0" ]; then
|
if [ "$?" -ne "0" ]; then
|
||||||
die "Failed to find kernel package version"
|
die "Failed to find kernel package version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
: ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"}
|
: ${OUTPUT_FILE="void-live-${TARGET_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"}
|
||||||
|
|
||||||
print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
|
print_step "Installing software to generate the image: ${REQUIRED_PKGS[*]} ..."
|
||||||
install_prereqs
|
install_prereqs "${REQUIRED_PKGS[@]}"
|
||||||
|
|
||||||
|
print_step "Installing software to generate the image: ${TARGET_PKGS[*]} ..."
|
||||||
|
install_target_pkgs "${TARGET_PKGS[@]}"
|
||||||
|
|
||||||
mkdir -p "$ROOTFS"/etc
|
mkdir -p "$ROOTFS"/etc
|
||||||
[ -s data/motd ] && cp data/motd "$ROOTFS"/etc
|
[ -s data/motd ] && cp data/motd "$ROOTFS"/etc
|
||||||
[ -s data/issue ] && cp data/issue "$ROOTFS"/etc
|
[ -s data/issue ] && cp data/issue "$ROOTFS"/etc
|
||||||
|
|
||||||
if [ -n "$IGNORE_PKGS" ]; then
|
if [ "${#IGNORE_PKGS[@]}" -gt 0 ]; then
|
||||||
print_step "Ignoring packages in the rootfs: ${IGNORE_PKGS} ..."
|
print_step "Ignoring packages in the rootfs: ${IGNORE_PKGS[*]} ..."
|
||||||
ignore_packages
|
ignore_packages
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
|
print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST[*]} ..."
|
||||||
install_packages
|
install_packages
|
||||||
|
|
||||||
: ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd}
|
: ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd}
|
||||||
|
@ -496,8 +563,10 @@ fi
|
||||||
print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
|
print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
|
||||||
generate_initramfs
|
generate_initramfs
|
||||||
|
|
||||||
print_step "Generating isolinux support for PC-BIOS systems..."
|
if [ "$IMAGE_TYPE" = hybrid ]; then
|
||||||
generate_isolinux_boot
|
print_step "Generating isolinux support for PC-BIOS systems..."
|
||||||
|
generate_isolinux_boot
|
||||||
|
fi
|
||||||
|
|
||||||
print_step "Generating GRUB support for EFI systems..."
|
print_step "Generating GRUB support for EFI systems..."
|
||||||
generate_grub_efi_boot
|
generate_grub_efi_boot
|
||||||
|
|
Loading…
Reference in New Issue