From c7784074c367fb7d39adc83caa1a85f49295e86f Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 23 Apr 2023 20:52:08 -0400 Subject: [PATCH 01/18] modules/kernel-config: Add missing basic options Some of those found by starting from a tinyconfig. Fixes #575 --- modules/kernel-config.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/kernel-config.nix b/modules/kernel-config.nix index d836ca3c..c2b0fc15 100644 --- a/modules/kernel-config.nix +++ b/modules/kernel-config.nix @@ -46,12 +46,18 @@ in EXT4_FS_POSIX_ACL = yes; # Required config for Nix + MULTIUSER = whenAtLeast "4.1" yes; NAMESPACES = yes; USER_NS = yes; PID_NS = yes; # Additional options SYSVIPC = yes; + TTY = whenAtLeast "3.9" yes; + VT = yes; + + # Support for initramfs + BLK_DEV_INITRD = yes; # Options from Android kernels that break stuff # While not *universally available*, it's universally required to @@ -79,6 +85,7 @@ in SYSFS_DEPRECATED = no; UEVENT_HELPER = no; FW_LOADER_USER_HELPER = option no; + BLOCK = yes; SCSI = yes; BLK_DEV_BSG = yes; DEVPTS_MULTIPLE_INSTANCES = whenOlder "4.7" yes; From 3710d77e0fb90d549f9284dac97c596adaf3a8ba Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 17:10:02 -0400 Subject: [PATCH 02/18] modules/kernel-config: Ensure needed config is present for logo --- modules/kernel-config.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/kernel-config.nix b/modules/kernel-config.nix index c2b0fc15..7f6922d4 100644 --- a/modules/kernel-config.nix +++ b/modules/kernel-config.nix @@ -90,6 +90,12 @@ in BLK_DEV_BSG = yes; DEVPTS_MULTIPLE_INSTANCES = whenOlder "4.7" yes; }) + # Needed for logo at boot + (helpers: with helpers; { + LOGO = yes; + FRAMEBUFFER_CONSOLE = yes; + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = whenAtLeast "4.19" no; + }) # Needed for firewall (helpers: with helpers; let inherit (lib) mkMerge; From ff292d16e42d5b23080e434cce56278f032da0b7 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:36:23 -0400 Subject: [PATCH 03/18] asus-dumo: Normalize kernel config --- devices/asus-dumo/kernel/config.aarch64 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devices/asus-dumo/kernel/config.aarch64 b/devices/asus-dumo/kernel/config.aarch64 index 40167c09..1017e9e1 100644 --- a/devices/asus-dumo/kernel/config.aarch64 +++ b/devices/asus-dumo/kernel/config.aarch64 @@ -3491,7 +3491,10 @@ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y # CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set # end of Console display driver support -# CONFIG_LOGO is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y # end of Graphics support CONFIG_SOUND=y From e064627f4dfd0fc2e644925cc54ae61d8f376394 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:36:44 -0400 Subject: [PATCH 04/18] asus-flo: Normalize kernel config --- devices/asus-flo/kernel/config.armv7 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/devices/asus-flo/kernel/config.armv7 b/devices/asus-flo/kernel/config.armv7 index 3f8a2df2..b23a2ff6 100644 --- a/devices/asus-flo/kernel/config.armv7 +++ b/devices/asus-flo/kernel/config.armv7 @@ -2411,6 +2411,7 @@ CONFIG_VIDEO_IR_I2C=y # # Miscelaneous helper chips # +# CONFIG_VIDEO_VIVI is not set CONFIG_MSM_VCAP=y CONFIG_V4L_USB_DRIVERS=y CONFIG_USB_VIDEO_CLASS=y @@ -2698,8 +2699,16 @@ CONFIG_BACKLIGHT_GENERIC=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_LOGO is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set CONFIG_SND=y From 19ffb46c86770690a3c91068e6bd4178403e9763 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:36:50 -0400 Subject: [PATCH 05/18] asus-z00t: Normalize kernel config --- devices/asus-z00t/kernel/config.aarch64 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/devices/asus-z00t/kernel/config.aarch64 b/devices/asus-z00t/kernel/config.aarch64 index 0e2f6cd1..22353076 100644 --- a/devices/asus-z00t/kernel/config.aarch64 +++ b/devices/asus-z00t/kernel/config.aarch64 @@ -2623,8 +2623,16 @@ CONFIG_BACKLIGHT_GENERIC=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_LOGO is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_FB_SSD1307 is not set CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set From c5f7d532b7544241042f5436cc92b348bbe0e73c Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:36:59 -0400 Subject: [PATCH 06/18] google-marlin: Normalize kernel config --- devices/google-marlin/kernel/config.aarch64 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/devices/google-marlin/kernel/config.aarch64 b/devices/google-marlin/kernel/config.aarch64 index a67d183a..bfc5a68d 100644 --- a/devices/google-marlin/kernel/config.aarch64 +++ b/devices/google-marlin/kernel/config.aarch64 @@ -2811,8 +2811,13 @@ CONFIG_BACKLIGHT_GENERIC=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_LOGO is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set CONFIG_SND=y @@ -4761,6 +4766,10 @@ CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y # CONFIG_QMI_ENCDEC_DEBUG is not set From 7b7d5ea0d478a5d0855a7b8a15483b05362cfc96 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:09 -0400 Subject: [PATCH 07/18] google-walleye: Normalize kernel config --- devices/google-walleye/kernel/config.aarch64 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devices/google-walleye/kernel/config.aarch64 b/devices/google-walleye/kernel/config.aarch64 index 25dc9b54..a6ec863c 100644 --- a/devices/google-walleye/kernel/config.aarch64 +++ b/devices/google-walleye/kernel/config.aarch64 @@ -2864,7 +2864,9 @@ CONFIG_VIDEOMODE_HELPERS=y CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_FRAMEBUFFER_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set @@ -4972,6 +4974,10 @@ CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y # CONFIG_SG_SPLIT is not set CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y From 6ccfc0251c7a396d02a143f70af2f7815076d2a6 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:19 -0400 Subject: [PATCH 08/18] motorola-addison: Normalize kernel config --- devices/motorola-addison/kernel/config.aarch64 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devices/motorola-addison/kernel/config.aarch64 b/devices/motorola-addison/kernel/config.aarch64 index 253a6f03..4ee7b3e6 100644 --- a/devices/motorola-addison/kernel/config.aarch64 +++ b/devices/motorola-addison/kernel/config.aarch64 @@ -3101,7 +3101,10 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y CONFIG_PANEL_NOTIFICATIONS=y CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set From deea4460be95d126a64bdaa27b6885ebcfaaa584 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:25 -0400 Subject: [PATCH 09/18] motorola-potter: Normalize kernel config --- devices/motorola-potter/kernel/config.aarch64 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/devices/motorola-potter/kernel/config.aarch64 b/devices/motorola-potter/kernel/config.aarch64 index d36c5e03..2ef06aca 100644 --- a/devices/motorola-potter/kernel/config.aarch64 +++ b/devices/motorola-potter/kernel/config.aarch64 @@ -1976,7 +1976,7 @@ CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_CONSOLE_SLEEP=y CONFIG_HW_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y CONFIG_DEVPTS_MULTIPLE_INSTANCES=y # CONFIG_LEGACY_PTYS is not set @@ -3046,8 +3046,13 @@ CONFIG_BACKLIGHT_GENERIC=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_LOGO is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_PANEL_NOTIFICATIONS is not set CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set @@ -5101,6 +5106,10 @@ CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y # CONFIG_QMI_ENCDEC_DEBUG is not set From 86c785e6d638a41ea5f389bb0d5e4761e990968a Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:33 -0400 Subject: [PATCH 10/18] oneplus-oneplus3: Normalize kernel config --- devices/oneplus-oneplus3/kernel/config.aarch64 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devices/oneplus-oneplus3/kernel/config.aarch64 b/devices/oneplus-oneplus3/kernel/config.aarch64 index ef7ba392..89106db8 100644 --- a/devices/oneplus-oneplus3/kernel/config.aarch64 +++ b/devices/oneplus-oneplus3/kernel/config.aarch64 @@ -2866,7 +2866,9 @@ CONFIG_VIDEOMODE_HELPERS=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set @@ -4605,6 +4607,10 @@ CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y # CONFIG_DDR is not set CONFIG_LIBFDT=y CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y # CONFIG_QMI_ENCDEC_DEBUG is not set From d30c2691e7037a51b90f3d945baba0a152b36238 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:42 -0400 Subject: [PATCH 11/18] sony-pioneer: Normalize kernel config --- devices/sony-pioneer/kernel/config.aarch64 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devices/sony-pioneer/kernel/config.aarch64 b/devices/sony-pioneer/kernel/config.aarch64 index 6e74fbec..bf8154fc 100644 --- a/devices/sony-pioneer/kernel/config.aarch64 +++ b/devices/sony-pioneer/kernel/config.aarch64 @@ -3169,7 +3169,9 @@ CONFIG_VIDEOMODE_HELPERS=y CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_FRAMEBUFFER_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set @@ -5419,6 +5421,10 @@ CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y # CONFIG_SG_SPLIT is not set CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y From bfddce25e9b9d7b5faeb33ce641d228dbaa18253 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 22:37:48 -0400 Subject: [PATCH 12/18] xiaomi-lavender: Normalize kernel config --- devices/xiaomi-lavender/kernel/config.aarch64 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devices/xiaomi-lavender/kernel/config.aarch64 b/devices/xiaomi-lavender/kernel/config.aarch64 index 0e17c10e..718cbe79 100644 --- a/devices/xiaomi-lavender/kernel/config.aarch64 +++ b/devices/xiaomi-lavender/kernel/config.aarch64 @@ -3144,7 +3144,9 @@ CONFIG_VIDEOMODE_HELPERS=y CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_FRAMEBUFFER_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set @@ -5358,6 +5360,10 @@ CONFIG_CLZ_TAB=y CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y # CONFIG_SG_SPLIT is not set CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_QMI_ENCDEC=y From 657a1f7a2dcd9e43e83ed2fea8b6414215ed2fed Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 17:59:17 -0400 Subject: [PATCH 13/18] artwork: Add boot logo --- artwork/boot-logo.svg | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 artwork/boot-logo.svg diff --git a/artwork/boot-logo.svg b/artwork/boot-logo.svg new file mode 100644 index 00000000..304e975e --- /dev/null +++ b/artwork/boot-logo.svg @@ -0,0 +1,22 @@ + + + + + From 296fa8953478ece1aa337b186d07ce3106e072c2 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 17:02:28 -0400 Subject: [PATCH 14/18] kernel/builder: Accept logo from pkgs There is no `override` that will work given the number of `callPackage` calls between this and the actual derivation. I guess `overrideAttrs` could be used instead, if we used an attribute of the derivation instead. I'm not sure if it's better since it would entail using `apply` to `overrideAttrs` the final `kernel.package` value. --- overlay/mobile-nixos/kernel/builder.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/overlay/mobile-nixos/kernel/builder.nix b/overlay/mobile-nixos/kernel/builder.nix index d34873b6..95f6458c 100644 --- a/overlay/mobile-nixos/kernel/builder.nix +++ b/overlay/mobile-nixos/kernel/builder.nix @@ -60,6 +60,11 @@ # It is expected this will have been added to the Nixpkgs overlay by the # system build. , systemBuild-structuredConfig ? {} + +# Only the logo file has to be overridable; the enable/disable flags are part +# of the builder signature such that if enabling the logo replacement causes +# issues, it can be disabled for a particular kernel. +, linuxLogo224PPMFile ? ./logo_linux_clut224.ppm }: let @@ -108,7 +113,6 @@ in # Linux logo replacement , enableLinuxLogoReplacement ? true -, linuxLogo224PPMFile ? ./logo_linux_clut224.ppm # Mainly to mask issues with newer compilers , enableRemovingWerror ? false From 50cd60ba821e2a83b5eda9df5dc639f6181fc9d0 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 17:04:08 -0400 Subject: [PATCH 15/18] modules/initrd-kernel: Add internal logo handling This will be augmented with automatic crop/resize based on device dimensions. --- modules/initrd-kernel.nix | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/modules/initrd-kernel.nix b/modules/initrd-kernel.nix index 75ad9ac9..fd904494 100644 --- a/modules/initrd-kernel.nix +++ b/modules/initrd-kernel.nix @@ -84,6 +84,33 @@ in This is not using a kernelPackages attrset, but a kernel derivation directly. ''; }; + # These options are not intended for end-user use, which is why they must + # all be marked internal. + # The only reason is to prevent needless rebuilds by end-users. + # Users that are curious enough are allowed to change that value. + logo = { + linuxLogo224PPMFile = mkOption { + type = types.package; + internal = true; + description = lib.mdDoc '' + Final logo file consumed by the Mobile NixOS kernel-builder infra. + ''; + }; + logo = mkOption { + type = with types; either package path; + internal = true; + description = lib.mdDoc '' + Input file for the logo. + + It will be scaled according to the device-specific configuration. + + For better results, the logo should have as much blank space as + needed to scale as expected. See the default logo for an example. + + The final logo will be cropped automatically. + ''; + }; + }; }; config = mkMerge [ @@ -112,6 +139,27 @@ in ]; }); } + # Logo configuration + { + nixpkgs.overlays = [(final: super: { + # This is how it's passed down to the kernel builder infra... + inherit (cfg.logo) linuxLogo224PPMFile; + })]; + mobile.boot.stage-1.kernel.logo = { + logo = mkDefault ../artwork/boot-logo.svg; + linuxLogo224PPMFile = pkgs.runCommand "logo_linux_clut224.ppm" { + nativeBuildInputs = with pkgs; [ + imagemagick + netpbm + perl # Needed by netpbm + ]; + } '' + convert ${cfg.logo.logo} converted.ppm + ppmquant 224 converted.ppm > quantized.ppm + pnmnoraw quantized.ppm > $out + ''; + }; + } { mobile.boot.stage-1 = (mkIf (!cfg.modular) { contents = [ From ca18fd63e356d67861ce99e977499d1450698bd7 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 19:24:15 -0400 Subject: [PATCH 16/18] modules/initrd-kernel: Resize the logo according to the display size By using a square aspect ratio logo as the source material, we can "fill" the area, which will not go outside of the bounds, which implies that the image is scaled to the smaller dimension. This image is then trimmed, meaning that it is cut to remove any redundant colour at the outside edge. --- modules/initrd-kernel.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/initrd-kernel.nix b/modules/initrd-kernel.nix index fd904494..931f8245 100644 --- a/modules/initrd-kernel.nix +++ b/modules/initrd-kernel.nix @@ -154,7 +154,10 @@ in perl # Needed by netpbm ]; } '' - convert ${cfg.logo.logo} converted.ppm + convert \ + ${cfg.logo.logo} \ + -resize ${toString config.mobile.hardware.screen.width}x${toString config.mobile.hardware.screen.height} \ + -trim converted.ppm ppmquant 224 converted.ppm > quantized.ppm pnmnoraw quantized.ppm > $out ''; From eb019f6e74438f5e2519bacb6aad83d17b48778a Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 2 May 2023 18:06:26 -0400 Subject: [PATCH 17/18] kernel/builder: Add forced logo patch for 5.4+ Technically this is an issue from 5.1, but the patch won't apply on 5.1, so let's target the following stable release. It serves no purpose to force on 5.1~5.3 which are EOL and should not have been used as a base by vendors. --- overlay/mobile-nixos/kernel/builder.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/overlay/mobile-nixos/kernel/builder.nix b/overlay/mobile-nixos/kernel/builder.nix index 95f6458c..cfd8ffea 100644 --- a/overlay/mobile-nixos/kernel/builder.nix +++ b/overlay/mobile-nixos/kernel/builder.nix @@ -17,6 +17,7 @@ { stdenv , lib , path +, fetchpatch , buildPackages , writeTextFile @@ -108,6 +109,9 @@ in # Enable build of dtbo.img , dtboImg ? false +# Enables a patch (for 5.4+) that forces the logo to be shown +, enableForceLogoPatch ? true + # Linux logo centering (as a boot logo) , enableCenteredLinuxLogo ? true @@ -232,6 +236,11 @@ stdenv.mkDerivation (inputArgs // { ++ optional ((lib.versionAtLeast version "4.13" && lib.versionOlder version "5.19")) (nixosKernelPath + "/randstruct-provide-seed.patch") ++ optional ((lib.versionAtLeast version "5.19")) (nixosKernelPath + "/randstruct-provide-seed-5.19.patch") ++ optional (enableDefaultYYLOCPatch && lib.versionOlder version "4.0") ./gcc10-extern_YYLOC_global_declaration.patch + ++ optional (enableForceLogoPatch && lib.versionAtLeast version "5.4") + (fetchpatch { + url = "https://github.com/samueldr/linux/commit/fa2b50d61364fbe3d6e2c655804605221ed43dce.patch"; + hash = "sha256-MOqHr7FUaiWs1OuKa66mVSa39jgsf0UETvIz1L8VXgY="; + }) ++ patches ; From ffdc031b2cfad478acb9a93127c31251fd6e6b59 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 24 Apr 2023 19:02:18 -0400 Subject: [PATCH 18/18] boot/init: Make FBDev a no-op ... this way, the framebuffer content is not evicted by a needless mode change. AFAIK none of our targets will be affected by this change. The framebuffer should already be setup with the correct mode. This was holdover from early early cargo-culting about the framebuffer. I have verified on a few devices, it does not worsen their behaviour. --- boot/init/tasks/graphics.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/boot/init/tasks/graphics.rb b/boot/init/tasks/graphics.rb index 770ed402..1000c6ef 100644 --- a/boot/init/tasks/graphics.rb +++ b/boot/init/tasks/graphics.rb @@ -21,12 +21,12 @@ class Tasks::Graphics < SingletonTask end # Handles the "legacy fbdev" style of framebuffers. +# (Does nothing, only handles dependencies) class Tasks::Graphics::FBDev < SingletonTask def initialize() add_dependency( :Files, - "/sys/class/graphics/fb0/mode", - "/sys/class/graphics/fb0/modes", + "/sys/class/graphics/fb0", ) # This is only incidental to the fact that /dev/fb0 wouldn't exist for # users of the "Graphics" dependency. @@ -34,9 +34,7 @@ class Tasks::Graphics::FBDev < SingletonTask end def run() - mode = File.read("/sys/class/graphics/fb0/modes") - log("Setting framebuffer mode to: #{mode}") - System.write("/sys/class/graphics/fb0/mode", mode) + # no-op end def ux_priority()