Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2020-07-29 18:18:33 +0300
committernl6720 <nl6720@gmail.com>2020-07-29 18:19:42 +0300
commitff0c13f90c4e4ca922171a08f7344e86cd64fcd0 (patch)
tree26fcd7ef9834e89c1cc995620517bdb38eaec04e
parenta5886ad71ec821a37a96f4bef94002186359792d (diff)
Build initramfs images only once
Place custom mkinitcpio.conf in airootfs. Use a custom mkinitcpio preset to specify generated image file path.
-rw-r--r--configs/baseline/airootfs/etc/mkinitcpio.conf69
-rw-r--r--configs/baseline/airootfs/etc/mkinitcpio.d/linux.preset11
-rwxr-xr-xconfigs/baseline/build.sh17
-rw-r--r--configs/baseline/mkinitcpio.conf4
-rw-r--r--configs/releng/airootfs/etc/mkinitcpio.conf69
-rw-r--r--configs/releng/airootfs/etc/mkinitcpio.d/linux.preset11
-rwxr-xr-xconfigs/releng/build.sh42
-rw-r--r--configs/releng/mkinitcpio.conf5
8 files changed, 179 insertions, 49 deletions
diff --git a/configs/baseline/airootfs/etc/mkinitcpio.conf b/configs/baseline/airootfs/etc/mkinitcpio.conf
new file mode 100644
index 0000000..9741d17
--- /dev/null
+++ b/configs/baseline/airootfs/etc/mkinitcpio.conf
@@ -0,0 +1,69 @@
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# vim:set ft=sh
+# MODULES
+# The following modules are loaded before any boot hooks are
+# run. Advanced users may wish to specify all system modules
+# in this array. For instance:
+# MODULES=(piix ide_disk reiserfs)
+MODULES=()
+
+# BINARIES
+# This setting includes any additional binaries a given user may
+# wish into the CPIO image. This is run last, so it may be used to
+# override the actual binaries included by a given hook
+# BINARIES are dependency parsed, so you may safely ignore libraries
+BINARIES=()
+
+# FILES
+# This setting is similar to BINARIES above, however, files are added
+# as-is and are not parsed in any way. This is useful for config files.
+FILES=()
+
+# HOOKS
+# This is the most important setting in this file. The HOOKS control the
+# modules and scripts added to the image, and what happens at boot time.
+# Order is important, and it is recommended that you do not change the
+# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
+# help on a given hook.
+# 'base' is _required_ unless you know precisely what you are doing.
+# 'udev' is _required_ in order to automatically load modules
+# 'filesystems' is _required_ unless you specify your fs modules in MODULES
+# Examples:
+## This setup specifies all modules in the MODULES setting above.
+## No raid, lvm2, or encrypted root is needed.
+# HOOKS=(base)
+#
+## This setup will autodetect all modules for your system and should
+## work as a sane default
+# HOOKS=(base udev autodetect block filesystems)
+#
+## This setup will generate a 'full' image which supports most systems.
+## No autodetection is done.
+# HOOKS=(base udev block filesystems)
+#
+## This setup assembles a pata mdadm array with an encrypted root FS.
+## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
+# HOOKS=(base udev block mdadm encrypt filesystems)
+#
+## This setup loads an lvm2 volume group on a usb device.
+# HOOKS=(base udev block lvm2 filesystems)
+#
+## NOTE: If you have /usr on a separate partition, you MUST include the
+# usr, fsck and shutdown hooks.
+HOOKS=(base udev archiso block filesystems)
+
+# COMPRESSION
+# Use this to compress the initramfs image. By default, gzip compression
+# is used. Use 'cat' to create an uncompressed image.
+#COMPRESSION="gzip"
+#COMPRESSION="bzip2"
+#COMPRESSION="lzma"
+#COMPRESSION="xz"
+#COMPRESSION="lzop"
+#COMPRESSION="lz4"
+
+# COMPRESSION_OPTIONS
+# Additional options for the compressor
+#COMPRESSION_OPTIONS=()
diff --git a/configs/baseline/airootfs/etc/mkinitcpio.d/linux.preset b/configs/baseline/airootfs/etc/mkinitcpio.d/linux.preset
new file mode 100644
index 0000000..a1949cd
--- /dev/null
+++ b/configs/baseline/airootfs/etc/mkinitcpio.d/linux.preset
@@ -0,0 +1,11 @@
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# mkinitcpio preset file for the 'linux' package on archiso
+
+PRESETS=('archiso')
+
+ALL_kver='/boot/vmlinuz-linux'
+ALL_config='/etc/mkinitcpio.conf'
+
+archiso_image="/boot/archiso.img"
diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh
index 92d1249..79cd34e 100755
--- a/configs/baseline/build.sh
+++ b/configs/baseline/build.sh
@@ -56,6 +56,11 @@ make_custom_airootfs() {
done < "${_airootfs}/etc/passwd"
fi
fi
+
+ mkdir -p -- "${work_dir}/airootfs/etc/initcpio/hooks"
+ mkdir -p -- "${work_dir}/airootfs/etc/initcpio/install"
+ cp /usr/lib/initcpio/hooks/archiso "${work_dir}/airootfs/etc/initcpio/hooks/"
+ cp /usr/lib/initcpio/install/archiso "${work_dir}/airootfs/etc/initcpio/install/"
}
# Packages (airootfs)
@@ -64,17 +69,6 @@ make_packages() {
-p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
}
-# Copy mkinitcpio archiso hooks and build initramfs (airootfs)
-make_setup_mkinitcpio() {
- mkdir -p "${work_dir}/airootfs/etc/initcpio/hooks"
- mkdir -p "${work_dir}/airootfs/etc/initcpio/install"
- cp /usr/lib/initcpio/hooks/archiso "${work_dir}/airootfs/etc/initcpio/hooks"
- cp /usr/lib/initcpio/install/archiso "${work_dir}/airootfs/etc/initcpio/install"
- cp "${script_path}/mkinitcpio.conf" "${work_dir}/airootfs/etc/mkinitcpio-archiso.conf"
- mkarchiso -v -w "${work_dir}" -D "${install_dir}" \
- -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run
-}
-
# Prepare ${install_dir}/boot/
make_boot() {
mkdir -p "${work_dir}/iso/${install_dir}/boot/${arch}"
@@ -118,7 +112,6 @@ make_iso() {
run_once make_custom_airootfs
run_once make_pacman_conf
run_once make_packages
-run_once make_setup_mkinitcpio
run_once make_boot
run_once make_syslinux
run_once make_isolinux
diff --git a/configs/baseline/mkinitcpio.conf b/configs/baseline/mkinitcpio.conf
deleted file mode 100644
index 2f9a39a..0000000
--- a/configs/baseline/mkinitcpio.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-HOOKS=(base udev archiso block filesystems)
diff --git a/configs/releng/airootfs/etc/mkinitcpio.conf b/configs/releng/airootfs/etc/mkinitcpio.conf
new file mode 100644
index 0000000..3476157
--- /dev/null
+++ b/configs/releng/airootfs/etc/mkinitcpio.conf
@@ -0,0 +1,69 @@
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# vim:set ft=sh
+# MODULES
+# The following modules are loaded before any boot hooks are
+# run. Advanced users may wish to specify all system modules
+# in this array. For instance:
+# MODULES=(piix ide_disk reiserfs)
+MODULES=()
+
+# BINARIES
+# This setting includes any additional binaries a given user may
+# wish into the CPIO image. This is run last, so it may be used to
+# override the actual binaries included by a given hook
+# BINARIES are dependency parsed, so you may safely ignore libraries
+BINARIES=()
+
+# FILES
+# This setting is similar to BINARIES above, however, files are added
+# as-is and are not parsed in any way. This is useful for config files.
+FILES=()
+
+# HOOKS
+# This is the most important setting in this file. The HOOKS control the
+# modules and scripts added to the image, and what happens at boot time.
+# Order is important, and it is recommended that you do not change the
+# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
+# help on a given hook.
+# 'base' is _required_ unless you know precisely what you are doing.
+# 'udev' is _required_ in order to automatically load modules
+# 'filesystems' is _required_ unless you specify your fs modules in MODULES
+# Examples:
+## This setup specifies all modules in the MODULES setting above.
+## No raid, lvm2, or encrypted root is needed.
+# HOOKS=(base)
+#
+## This setup will autodetect all modules for your system and should
+## work as a sane default
+# HOOKS=(base udev autodetect block filesystems)
+#
+## This setup will generate a 'full' image which supports most systems.
+## No autodetection is done.
+# HOOKS=(base udev block filesystems)
+#
+## This setup assembles a pata mdadm array with an encrypted root FS.
+## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
+# HOOKS=(base udev block mdadm encrypt filesystems)
+#
+## This setup loads an lvm2 volume group on a usb device.
+# HOOKS=(base udev block lvm2 filesystems)
+#
+## NOTE: If you have /usr on a separate partition, you MUST include the
+# usr, fsck and shutdown hooks.
+HOOKS=(base udev memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block filesystems keyboard)
+
+# COMPRESSION
+# Use this to compress the initramfs image. By default, gzip compression
+# is used. Use 'cat' to create an uncompressed image.
+#COMPRESSION="gzip"
+#COMPRESSION="bzip2"
+#COMPRESSION="lzma"
+COMPRESSION="xz"
+#COMPRESSION="lzop"
+#COMPRESSION="lz4"
+
+# COMPRESSION_OPTIONS
+# Additional options for the compressor
+#COMPRESSION_OPTIONS=()
diff --git a/configs/releng/airootfs/etc/mkinitcpio.d/linux.preset b/configs/releng/airootfs/etc/mkinitcpio.d/linux.preset
new file mode 100644
index 0000000..a1949cd
--- /dev/null
+++ b/configs/releng/airootfs/etc/mkinitcpio.d/linux.preset
@@ -0,0 +1,11 @@
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# mkinitcpio preset file for the 'linux' package on archiso
+
+PRESETS=('archiso')
+
+ALL_kver='/boot/vmlinuz-linux'
+ALL_config='/etc/mkinitcpio.conf'
+
+archiso_image="/boot/archiso.img"
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index e360f23..888c061 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -86,44 +86,31 @@ make_custom_airootfs() {
done < "${_airootfs}/etc/passwd"
fi
fi
-}
-
-# Packages (airootfs)
-make_packages() {
- if [ -n "${verbose}" ]; then
- mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \
- -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
- else
- mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \
- -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
- fi
-}
-# Copy mkinitcpio archiso hooks and build initramfs (airootfs)
-make_setup_mkinitcpio() {
local _hook
- mkdir -p "${work_dir}/x86_64/airootfs/etc/initcpio/hooks"
- mkdir -p "${work_dir}/x86_64/airootfs/etc/initcpio/install"
+ mkdir -p -- "${work_dir}/x86_64/airootfs/etc/initcpio/hooks"
+ mkdir -p -- "${work_dir}/x86_64/airootfs/etc/initcpio/install"
for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do
- cp "/usr/lib/initcpio/hooks/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/hooks"
- cp "/usr/lib/initcpio/install/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/install"
+ cp "/usr/lib/initcpio/hooks/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/hooks/"
+ cp "/usr/lib/initcpio/install/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/install/"
done
sed -i "s|/usr/lib/initcpio/|/etc/initcpio/|g" "${work_dir}/x86_64/airootfs/etc/initcpio/install/archiso_shutdown"
- cp /usr/lib/initcpio/install/archiso_kms "${work_dir}/x86_64/airootfs/etc/initcpio/install"
- cp /usr/lib/initcpio/archiso_shutdown "${work_dir}/x86_64/airootfs/etc/initcpio"
- cp "${script_path}/mkinitcpio.conf" "${work_dir}/x86_64/airootfs/etc/mkinitcpio-archiso.conf"
+ cp /usr/lib/initcpio/install/archiso_kms "${work_dir}/x86_64/airootfs/etc/initcpio/install/"
+ cp /usr/lib/initcpio/archiso_shutdown "${work_dir}/x86_64/airootfs/etc/initcpio/"
+}
+
+# Packages (airootfs)
+make_packages() {
if [[ "${gpg_key}" ]]; then
gpg --export "${gpg_key}" > "${work_dir}/gpgkey"
exec 17<>"${work_dir}/gpgkey"
fi
if [ -n "${verbose}" ]; then
- ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" \
- -D "${install_dir}" \
- -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run
+ ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \
+ -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
else
- ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" \
- -D "${install_dir}" \
- -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run
+ ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \
+ -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
fi
if [[ "${gpg_key}" ]]; then
exec 17<&-
@@ -321,7 +308,6 @@ run_once make_pacman_conf
run_once make_custom_airootfs
run_once make_packages
run_once make_customize_airootfs
-run_once make_setup_mkinitcpio
run_once make_boot
run_once make_boot_extra
run_once make_syslinux
diff --git a/configs/releng/mkinitcpio.conf b/configs/releng/mkinitcpio.conf
deleted file mode 100644
index 1b35687..0000000
--- a/configs/releng/mkinitcpio.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-HOOKS=(base udev memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block filesystems keyboard)
-COMPRESSION="xz"