Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lineageos: Lineage 21.0 support #238

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ lib.listToAttrs (builtins.map (c: lib.nameValuePair "${c.flavor}-${c.device}" c)
{ device="barbet"; flavor="vanilla"; }
{ device="raven"; flavor="vanilla"; }
{ device="oriole"; flavor="vanilla"; }
{ device="cheetah"; flavor="vanilla"; }

{ device="x86_64"; flavor="grapheneos"; }
{ device="arm64"; flavor="grapheneos"; }
Expand All @@ -35,6 +36,7 @@ lib.listToAttrs (builtins.map (c: lib.nameValuePair "${c.flavor}-${c.device}" c)

{ device="marlin"; flavor="lineageos"; }
{ device="pioneer"; flavor="lineageos"; }
{ device="cheetah"; flavor="lineageos"; }

{ device="x86_64"; flavor="anbox"; }
{ device="arm64"; flavor="anbox"; }
Expand Down
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ let
./modules/11
./modules/12
./modules/13
./modules/14
./modules/9
./modules/apps/auditor.nix
./modules/apps/chromium.nix
Expand Down
30 changes: 30 additions & 0 deletions flavors/lineageos/0001-Remove-LineageOS-keys-21.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 0ba0ae56b5b7a4196f30b7c9cc899785797552bb Mon Sep 17 00:00:00 2001
From: Daniel Fullmer <[email protected]>
Date: Thu, 7 May 2020 17:52:03 -0400
Subject: [PATCH] Remove LineageOS keys

Signing target files would fail:
extra recovery-only key(s): vendor/lineage/build/target/product/security/lineage.x509.pem
However, that key is not available in our build environment. We don't
want to include them anyway.
---
config/common.mk | 4 ----
1 file changed, 4 deletions(-)

diff --git a/config/common.mk b/config/common.mk
index ca58f4ad..70f04cad 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -243,12 +243,7 @@ CUSTOM_LOCALES += \
PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS += vendor/crowdin/overlay
PRODUCT_PACKAGE_OVERLAYS += vendor/crowdin/overlay

-PRODUCT_EXTRA_RECOVERY_KEYS += \
- vendor/lineage/build/target/product/security/lineage
-
include vendor/lineage/config/version.mk

--include vendor/lineage-priv/keys/keys.mk
-
-include $(WORKSPACE)/build_env/image-auto-bits.mk
-include vendor/lineage/config/partner_gms.mk
23 changes: 23 additions & 0 deletions flavors/lineageos/0002-bootanimation-Reproducibility-fix-21.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 9b6e454e4a7b7c23a1fc4b44dcc07ff5bcd14191 Mon Sep 17 00:00:00 2001
From: Daniel Fullmer <[email protected]>
Date: Sun, 10 May 2020 18:33:27 -0400
Subject: [PATCH 2/3] bootanimation: Reproducibility fix

---
bootanimation/Android.mk | 3 +++
1 file changed, 3 insertions(+)

diff --git a/bootanimation/Android.mk b/bootanimation/Android.mk
index 97948f38..64f5aac9 100644
--- a/bootanimation/Android.mk
+++ b/bootanimation/Android.mk
@@ -35,6 +35,9 @@ $(TARGET_GENERATED_BOOTANIMATION): $(SOONG_ZIP)
IMAGEHEIGHT=$$(expr $$IMAGEWIDTH / 3); \
RESOLUTION="$$IMAGEWIDTH"x"$$IMAGEHEIGHT"; \
prebuilts/tools-lineage/${HOST_OS}-x86/bin/mogrify -resize $$RESOLUTION -colors 256 $(INTERMEDIATES)/*/*.png; \
+ for f in $(INTERMEDIATES)/*/*.png; do \
+ @imagemagick@/bin/convert -strip "$$f" "$$f"; \
+ done; \
echo "$$IMAGESCALEWIDTH $$IMAGESCALEHEIGHT 60" > $(INTERMEDIATES)/desc.txt; \
cat vendor/lineage/bootanimation/desc.txt >> $(INTERMEDIATES)/desc.txt
$(hide) $(SOONG_ZIP) -L 0 -o $@ -C $(INTERMEDIATES) -D $(INTERMEDIATES)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From a0de58b8fdba9fd3725eb604dec0cdc92ccfb4a2 Mon Sep 17 00:00:00 2001
From: Daniel Fullmer <[email protected]>
Date: Sun, 10 May 2020 18:50:33 -0400
Subject: [PATCH] kernel: Set constant kernel timestamp

---
build/tasks/kernel.mk | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 0c2e179e..4c35eac9 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -275,7 +275,7 @@ endif
# $(1): output path (The value passed to O=)
# $(2): target to build (eg. defconfig, modules, dtbo.img)
define internal-make-kernel-target
-$(PATH_OVERRIDE) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_BUILD_OUT_PREFIX)$(1) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_CLANG_TRIPLE) $(KERNEL_CC) $(2)
+$(PATH_OVERRIDE) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) $(KERNEL_TIMESTAMP) -C $(KERNEL_SRC) O=$(KERNEL_BUILD_OUT_PREFIX)$(1) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_CLANG_TRIPLE) $(KERNEL_CC) $(2)
endef

# Make an external module target
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 9189864d..0c98a91d 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
26 changes: 20 additions & 6 deletions flavors/lineageos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let
"11" = "lineage-18.1";
"12" = "lineage-19.1";
"13" = "lineage-20.0";
"14" = "lineage-21.0";
};
lineageBranchToAndroidVersion = mapAttrs' (name: value: nameValuePair value name) androidVersionToLineageBranch;

Expand Down Expand Up @@ -93,19 +94,25 @@ in mkIf (config.flavor == "lineageos")

{
"vendor/lineage".patches = [
(if lib.versionAtLeast (toString config.androidVersion) "13"
(if lib.versionAtLeast (toString config.androidVersion) "14"
then ./0001-Remove-LineageOS-keys-21.patch
else if lib.versionAtLeast (toString config.androidVersion) "13"
then ./0001-Remove-LineageOS-keys-20.patch
else ./0001-Remove-LineageOS-keys-19.patch)

(pkgs.substituteAll {
src = ./0002-bootanimation-Reproducibility-fix.patch;
src = (if lib.versionAtLeast (toString config.androidVersion) "14"
then ./0002-bootanimation-Reproducibility-fix-21.patch else
./0002-bootanimation-Reproducibility-fix-.patch);
inherit (pkgs) imagemagick;
})

(if lib.versionAtLeast (toString config.androidVersion) "13"
(if lib.versionAtLeast (toString config.androidVersion) "14"
then ./0003-kernel-Set-constant-kernel-timestamp-21.patch
else if lib.versionAtLeast (toString config.androidVersion) "13"
then ./0003-kernel-Set-constant-kernel-timestamp-20.patch
else ./0003-kernel-Set-constant-kernel-timestamp-19.patch)

] ++ lib.optionals (lib.versionAtLeast (toString config.androidVersion) "13") [
./dont-run-repo-during-build.patch
];
Expand Down Expand Up @@ -135,10 +142,17 @@ in mkIf (config.flavor == "lineageos")
relpaths = relpathWithDeps deviceRelpath;
filteredRelpaths = remove (attrNames repoDirs) relpaths; # Remove any repos that we're already including from repo json

# In LOS20, each device/ relpath has an associated vendor/ relpath.
# In LOS20/21, each device/ relpath has an associated vendor/ relpath.
# Well, usually...
deviceRelpaths = filter (path: hasPrefix "device/" path) relpaths;
vendorifiedRelpaths = map (replaceStrings [ "device/" ] [ "vendor/" ]) deviceRelpaths;
vendorifiedRelpaths = map (replaceStrings [ "device/" ] [ "vendor/" ])
(filter
(
deviceRelpath: !(builtins.hasAttr "noVendor" deviceDirs.${deviceRelpath})
|| deviceDirs.${deviceRelpath}.noVendor == false
)
deviceRelpaths
);

vendorRelpaths = if config.androidVersion >= 13 then (
# LOS20 needs vendor/$vendor/$device and all the common dirs but with
Expand Down
Loading