1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 13:10:29 +03:00

Merge pull request #195 from samueldr-wip/feature/initrd/compression

initrd: Make compression method an option
This commit is contained in:
Samuel Dionne-Riel 2020-08-22 21:34:55 -04:00 committed by GitHub
commit b09db9c430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 4 deletions

View File

@ -31,6 +31,12 @@
};
};
# Using `xz` allows us to fit the kernel + dt + initrd in 16MiB
# Kernel: ~8.8M
# DT: 1.2M
# We're left with ~6MB for the compressed initrd.
mobile.boot.stage-1.compression = lib.mkDefault "xz";
boot.kernelParams = [
"androidboot.console=ttyHSL0"
"androidboot.hardware=qcom"

View File

@ -163,7 +163,7 @@ CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@ -1099,6 +1099,7 @@ CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_IRQ=y
CONFIG_REGMAP_SWR=y
CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS=y
CONFIG_DMA_SHARED_BUFFER=y
# CONFIG_FENCE_TRACE is not set
@ -1321,7 +1322,7 @@ CONFIG_FSUSB42_MUX=y
# Altera FPGA firmware download module
#
# CONFIG_ALTERA_STAPL is not set
# CONFIG_MSM_QDSP6V2_CODECS is not set
CONFIG_MSM_QDSP6V2_CODECS=y
# CONFIG_MSM_ULTRASOUND is not set
# CONFIG_MSM_MCU_TIME_SYNC is not set
@ -1925,6 +1926,7 @@ CONFIG_TOUCHSCREEN_FT5X06=y
CONFIG_TOUCHSCREEN_NT36xxx=y
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AD714X is not set
# CONFIG_INPUT_ARIZONA_HAPTICS is not set
# CONFIG_INPUT_BMA150 is not set
# CONFIG_INPUT_HBTP_INPUT is not set
# CONFIG_INPUT_MMA8450 is not set
@ -2631,6 +2633,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_PROXY_CONSUMER is not set
# CONFIG_REGULATOR_ACT8865 is not set
# CONFIG_REGULATOR_AD5398 is not set
# CONFIG_REGULATOR_ARIZONA is not set
CONFIG_REGULATOR_STUB=y
# CONFIG_REGULATOR_DA9210 is not set
# CONFIG_REGULATOR_DA9211 is not set
@ -3005,6 +3008,7 @@ CONFIG_FB_MSM=y
# CONFIG_FB_AUO_K190X is not set
# CONFIG_FB_SIMPLE is not set
# CONFIG_FB_QUICKDRAW is not set
# CONFIG_MSM_BA_V4L2 is not set
CONFIG_MSM_DBA=y
CONFIG_MSM_DBA_ADV7533=y
CONFIG_MSM_DBA_MOT_DBA=y
@ -3310,6 +3314,7 @@ CONFIG_HID_APPLE=y
# CONFIG_HID_BELKIN is not set
# CONFIG_HID_CHERRY is not set
# CONFIG_HID_CHICONY is not set
# CONFIG_HID_PRODIKEYS is not set
# CONFIG_HID_CP2112 is not set
# CONFIG_HID_CYPRESS is not set
# CONFIG_HID_DRAGONRISE is not set
@ -3738,6 +3743,7 @@ CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_CAMERA is not set
CONFIG_SWITCH=y
# CONFIG_SWITCH_GPIO is not set
# CONFIG_SWITCH_ARIZONA is not set
# CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set
CONFIG_EDAC_SUPPORT=y
@ -3895,6 +3901,7 @@ CONFIG_STAGING=y
# CONFIG_R8188EU is not set
# CONFIG_R8723AU is not set
# CONFIG_RTS5208 is not set
# CONFIG_LINE6_USB is not set
# CONFIG_VT6655 is not set
#
@ -5060,9 +5067,17 @@ CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4_COMPRESS=y
CONFIG_LZ4_DECOMPRESS=y
# CONFIG_XZ_DEC is not set
# CONFIG_XZ_DEC_BCJ is not set
CONFIG_XZ_DEC=y
CONFIG_XZ_DEC_X86=y
CONFIG_XZ_DEC_POWERPC=y
CONFIG_XZ_DEC_IA64=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_SPARC=y
CONFIG_XZ_DEC_BCJ=y
# CONFIG_XZ_DEC_TEST is not set
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_REED_SOLOMON=y
CONFIG_REED_SOLOMON_ENC8=y

View File

@ -181,6 +181,15 @@ let
initrd = makeInitrd {
name = "initrd-${device_config.name}";
inherit contents;
compressor = {
# Default from <nixpkgs/pkgs/build-support/kernel/make-initrd.nix>
gzip = "gzip -9n";
# The `--check` option is required since the kernel's implementation is minimal.
# `-e` trades CPU runtime at compression to find the best compression possible.
xz = "xz -9 -e --check=crc32";
}.${config.mobile.boot.stage-1.compression};
};
# ncdu -f result/initrd.ncdu
@ -201,6 +210,16 @@ let
in
{
options = {
mobile.boot.stage-1.compression = mkOption {
type = types.enum [ "gzip" "xz" ];
default = "gzip";
description = ''
The compression method for the stage-1 (initrd).
This may be set as a default by some devices requiring specific
compression methods. Most likely to work around size limitations.
'';
};
mobile.boot.stage-1.tasks = mkOption {
type = with types; listOf (either package path);
default = [];