|
3 | 3 | # Build kernel, modules and initial ramdisk in correct sequence, ensuring kernel |
4 | 4 | # config is conformed, then sign if possible and copy to EFI boot partition. |
5 | 5 | # |
6 | | -# Copyright (c) 2014-2017 sakaki <sakaki@deciban.com> |
| 6 | +# Copyright (c) 2014-2018 sakaki <sakaki@deciban.com> |
7 | 7 | # |
8 | 8 | # License (GPL v3.0) |
9 | 9 | # ------------------ |
@@ -31,7 +31,7 @@ shopt -s nullglob |
31 | 31 | # ********************** variables ********************* |
32 | 32 | PROGNAME="$(basename "${0}")" |
33 | 33 | CONFFILE="/etc/${PROGNAME}.conf" |
34 | | -VERSION="1.0.29" |
| 34 | +VERSION="1.0.30" |
35 | 35 | ETCPROFILE="/etc/profile" |
36 | 36 | DEFAULTEFIBOOTFILE="bootx64.efi" |
37 | 37 | EFIBOOTFILE="${DEFAULTEFIBOOTFILE}" |
@@ -77,6 +77,8 @@ CMDLINE_REAL_ROOT="/dev/mapper/vg1-root" |
77 | 77 | CMDLINE_REAL_RESUME="/dev/mapper/vg1-swap" |
78 | 78 | declare -i DEFAULTCREATEEFIBOOT=1 |
79 | 79 | declare -i CREATEEFIBOOT="${DEFAULTCREATEEFIBOOT}" |
| 80 | +declare -i DEFAULTCOMPRESSINITRAMFS=1 |
| 81 | +declare -i COMPRESSINITRAMFS="${DEFAULTCOMPRESSINITRAMFS}" |
80 | 82 | # you can use xconfig etc if you like - override in /etc/buildkernel.conf |
81 | 83 | CONFIGTYPE="menuconfig" |
82 | 84 | # following should already be in the environment; but to be safe... |
@@ -1633,12 +1635,28 @@ conform_config_file() { |
1633 | 1635 | set_kernel_config "CMDLINE" "\"${KERNEL_CMD_LINE}\"" |
1634 | 1636 | show "Setting up initramfs location and type..." |
1635 | 1637 | set_kernel_config "INITRAMFS_SOURCE" "\"${UNCOMPRESSEDINITRAMFS}\"" |
1636 | | - # initramfs compression must be 'none' - not as big a deal as it sounds, |
1637 | | - # since the encapsulating kernel image will itself be compressed... |
1638 | | - for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO"; do |
1639 | | - unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}" |
1640 | | - done |
1641 | | - set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y" |
| 1638 | + # unless the user specifically directs, we will compress the initramfs with |
| 1639 | + # XZ - although the enclosing kernel will be compressed anyway, this can |
| 1640 | + # help on low-memory systems; also the need to leave compression off seems |
| 1641 | + # to no longer apply with modern kernels |
| 1642 | + if ((COMPRESSINITRAMFS==1)); then |
| 1643 | + show "Using XZ compression for built-in initramfs" |
| 1644 | + unset_kernel_config "INITRAMFS_COMPRESSION_NONE" |
| 1645 | + for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "LZO" "LZ4"; do |
| 1646 | + unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}" |
| 1647 | + done |
| 1648 | + set_kernel_config "INITRAMFS_COMPRESSION_XZ" "y" |
| 1649 | + set_kernel_config "INITRAMFS_COMPRESSION" ".xz" |
| 1650 | + else |
| 1651 | + warning "As requested, not compressing the built-in initramfs" |
| 1652 | + warning "This can lead to boot failure on memory-constrained systems" |
| 1653 | + for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO" "LZ4"; do |
| 1654 | + unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}" |
| 1655 | + done |
| 1656 | + set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y" |
| 1657 | + set_kernel_config "INITRAMFS_COMPRESSION" "" |
| 1658 | + fi |
| 1659 | + |
1642 | 1660 | # ensure we can get at the LUKS volume! note that these could also be |
1643 | 1661 | # modules really, since we copy all modules into the initramfs |
1644 | 1662 | show "Ensuring Serpent, Whirlpool and SHA-512 are included..." |
@@ -1767,7 +1785,9 @@ rebuild_external_modules_if_necessary() { |
1767 | 1785 | create_initramfs_using_genkernel() { |
1768 | 1786 | show "Creating initramfs (uncompressed)..." |
1769 | 1787 | # this is a partial use of genkernel, we don't use it to build the kernel |
1770 | | - # itself; also note, EFI kernels *require* an uncompressed ramdisk |
| 1788 | + # itself; also note, we build an uncompressed ramdisk, as the kernel |
| 1789 | + # build process will compress it on integration into the |
| 1790 | + # unified kernel image |
1771 | 1791 | # we suppress gpg here as we don't want to add gpg v2 which is installed, |
1772 | 1792 | # but rather our static gpg v1, which will be inserted into the initramfs |
1773 | 1793 | local PLYMOUTH_OPTS="" |
|
0 commit comments