1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-03 14:47:18 +03:00

Merge pull request #613 from samueldr-wip/feature/kernel-logo-as-early-splash

Use the kernel logo feature as early splash
This commit is contained in:
Samuel Dionne-Riel 2023-05-05 16:11:08 -04:00 committed by GitHub
commit d734a57aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 183 additions and 21 deletions

22
artwork/boot-logo.svg Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
viewBox="0 0 720 720"
height="4096"
width="4096"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rect
style="fill:#000000;fill-opacity:1;stroke:none;"
width="720"
height="720"
x="0"
y="0"
ry="0" />
<path
d="m 362.49305,270.00387 c -5.04185,0.12735 -9.88901,3.35513 -12.54371,7.95321 l -66.22427,114.7055 c -3.77561,6.53951 -2.9353,15.5366 3.96128,19.51833 l 63.67875,36.76289 c 0.78723,0.45451 1.5936,0.79623 2.4066,1.0562 l 0.47396,-13.08713 -60.62862,-35.0039 c -0.0706,-0.0406 -0.82738,-1.22804 0.37795,-3.31572 l 66.22629,-114.70753 c 1.20534,-2.08769 2.61186,-2.02445 2.68239,-1.98371 l 61.21905,35.34304 h 14.37827 c -0.59088,-3.58379 -2.52534,-6.84979 -5.98992,-8.85006 l -63.6767,-36.76493 c -1.72415,-0.99544 -3.53137,-1.5054 -5.33007,-1.60984 -0.33725,-0.0195 -0.67513,-0.0248 -1.01125,-0.0163 z"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 = [

View File

@ -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;

View File

@ -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
;