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 @@ + + + + + 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() 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 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 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 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 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 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 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 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 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 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 diff --git a/modules/initrd-kernel.nix b/modules/initrd-kernel.nix index 75ad9ac9..931f8245 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,30 @@ 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} \ + -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 + ''; + }; + } { mobile.boot.stage-1 = (mkIf (!cfg.modular) { contents = [ diff --git a/modules/kernel-config.nix b/modules/kernel-config.nix index d836ca3c..7f6922d4 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,10 +85,17 @@ 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; }) + # 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; diff --git a/overlay/mobile-nixos/kernel/builder.nix b/overlay/mobile-nixos/kernel/builder.nix index d34873b6..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 @@ -60,6 +61,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 @@ -103,12 +109,14 @@ 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 # Linux logo replacement , enableLinuxLogoReplacement ? true -, linuxLogo224PPMFile ? ./logo_linux_clut224.ppm # Mainly to mask issues with newer compilers , enableRemovingWerror ? false @@ -228,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 ;