Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
initramfs: enable xz compression
Browse files Browse the repository at this point in the history
Signed-off-by: Marin Hannache <[email protected]>
  • Loading branch information
Marin Hannache committed Sep 18, 2018
1 parent 49d0d9a commit be41be8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
28 changes: 25 additions & 3 deletions arch-creator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ conf() {
gen_kernel() {
step "Generating kernel & initramfs"

run_chroot "pacman -Sy --noconfirm linux linux-headers git asciidoc dhclient cpio"
run_chroot "pacman -Sy --noconfirm --needed linux linux-headers git asciidoc dhclient cpio xz rng-tools"
kver=$(cd "${ROOTFS_DIR}/lib/modules/"; echo [0-9]*.*-ARCH)

run_chroot_unless '[ -d "${ROOTFS_DIR}/root/dracut" ]' "git clone https://github.com/epita/dracut.git /root/dracut"
Expand All @@ -182,6 +182,8 @@ gen_kernel() {
run cp "${ROOTFS_DIR}/root/initramfs-linux.img" \
"${IMAGES_DIR}/${IMAGE_NAME}_initramfs-linux.img"

chmod +r "${IMAGES_DIR}/${IMAGE_NAME}_initramfs-linux.img"

unstep
}

Expand All @@ -193,7 +195,7 @@ clean_fs() {
run find "${ROOTFS_DIR}/var/lib/pacman" -maxdepth 1 -type f -delete
run find "${ROOTFS_DIR}/var/lib/pacman/sync" -delete
run find "${ROOTFS_DIR}/var/cache/pacman/pkg" -type f -delete
run find "${ROOTFS_DIR}/root/dracut" -type f -delete
run rm -rf "${ROOTFS_DIR}/root/dracut"

run echo > "${ROOTFS_DIR}/etc/machine-id"
run rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id"
Expand Down Expand Up @@ -291,6 +293,26 @@ torrent() {
unstep
}

genkernel() {
IMAGE_NAME=${1:-"${DEFAULT_IMAGE}"}
ROOTFS_DIR="${WORK_DIR}/${IMAGE_NAME}/rootfs"
IMAGE_FILE="${IMAGES_DIR}/${IMAGE_NAME}.squashfs"

if [[ $EUID -ne 0 ]]; then
printf "${C_RED}$0: The build command can only be run as root.${C_RESET}\n" 1>&2
exit 1
fi

step "Generating kernel and initramfs"

create_dirs
mount_bind
bootstrap
gen_kernel

unstep
}

GO_SHORT="hide:m:t:"
GO_LONG="help,ignore-failures,debug,environment,master:,tracker:"

Expand Down Expand Up @@ -345,7 +367,7 @@ done
CMD="$1"
shift
case "$CMD" in
build|clean|torrent)
build|clean|torrent|genkernel)
$CMD "$@"
;;
*)
Expand Down
7 changes: 4 additions & 3 deletions files/dracut-cri.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ dracutmodules+="bash "
dracutmodules+="dracut-systemd "
dracutmodules+="kernel-modules "
dracutmodules+="diskless "
#dracutmodules+="resume "
#dracutmodules+="shutdown "
dracutmodules+="systemd "
dracutmodules+="systemd-initrd "

drivers+="overlay"
add_drivers+="overlay "
add_drivers+="loop "
add_drivers+="squashfs "

hostonly="no"
hostonly_cmdline="no"
use_fstab="no"
mdadmconf="no"
nofscks="yes"
compress="xz"

0 comments on commit be41be8

Please sign in to comment.