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

Review the kernel builder ergonomics #212

Merged
merged 32 commits into from Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
62fe140
kernel-builder: Rework its ergonomics
samueldr Sep 30, 2020
1889893
kernel-builder: implement QCDT configuration in the builder
samueldr Oct 1, 2020
9bac03b
kernel-builder: Encapsulate compressed images and dtb appended images
samueldr Oct 2, 2020
e8cd8a9
kernel-builder: minor fixups
samueldr Oct 2, 2020
47f6fc0
asus-dumo: Update usage of kernel builder
samueldr Oct 1, 2020
8f59c5b
asus-flo: Update usage of kernel builder
samueldr Oct 1, 2020
c15684d
asus-x018d: Update usage of kernel builder
samueldr Oct 1, 2020
7dc514e
asus-z00t: Update usage of kernel builder
samueldr Oct 1, 2020
f01f499
google-marlin: Update usage of kernel builder
samueldr Oct 1, 2020
802c0fb
google-walleye: Update usage of kernel builder
samueldr Oct 1, 2020
ccd3a54
motorola-addison: Update usage of kernel builder
samueldr Oct 1, 2020
3c07e7f
oneplus-oneplus3: Update usage of kernel builder
samueldr Oct 1, 2020
52f4885
pine64-pinephone-braveheart: Update usage of kernel builder
samueldr Oct 1, 2020
b4e30da
sony-pioneer: Update usage of kernel builder
samueldr Oct 1, 2020
0b9b597
xiaomi-begonia: Update usage of kernel builder
samueldr Oct 1, 2020
9356bbd
xiaomi-lavender: Update usage of kernel builder
samueldr Oct 1, 2020
ff49550
xiaomi-tissot: Update usage of kernel builder
samueldr Oct 1, 2020
5deb826
asus-dumo: drop unused kernelPatches argument
samueldr Oct 2, 2020
f95f5f2
asus-flo: drop unused kernelPatches argument
samueldr Oct 2, 2020
53b4c5c
asus-x018d: drop unused kernelPatches argument
samueldr Oct 2, 2020
a3e2bfc
asus-z00t: drop unused kernelPatches argument
samueldr Oct 2, 2020
c3037f6
google-marlin: drop unused kernelPatches argument
samueldr Oct 2, 2020
dde7cd4
google-walleye: drop unused kernelPatches argument
samueldr Oct 2, 2020
86d08e3
motorola-addison: drop unused kernelPatches argument
samueldr Oct 2, 2020
f17c31e
oneplus-oneplus3: drop unused kernelPatches argument
samueldr Oct 2, 2020
70e7259
pine64-pinephone-braveheart: drop unused kernelPatches argument
samueldr Oct 2, 2020
61b0145
sony-pioneer: drop unused kernelPatches argument
samueldr Oct 2, 2020
7bff007
xiaomi-begonia: drop unused kernelPatches argument
samueldr Oct 2, 2020
6b24825
xiaomi-lavender: drop unused kernelPatches argument
samueldr Oct 2, 2020
0143cec
xiaomi-tissot: drop unused kernelPatches argument
samueldr Oct 2, 2020
9210f71
overlay: Dropped now unused defaultKernelPatches
samueldr Oct 2, 2020
36a99a3
doc: Add kernel-builder documentation
samueldr Oct 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions devices/asus-dumo/kernel/default.nix
Expand Up @@ -2,15 +2,12 @@
mobile-nixos
, fetchFromGitHub
, fetchgit
, kernelPatches ? [] # FIXME
}:

(mobile-nixos.kernel-builder {
mobile-nixos.kernel-builder {
version = "5.8.0";
configfile = ./config.aarch64;

hasDTB = true;

src = fetchFromGitHub {
owner = "torvalds";
repo = "linux";
Expand All @@ -26,4 +23,4 @@
];

isModular = false;
})
}
2 changes: 1 addition & 1 deletion devices/asus-flo/default.nix
Expand Up @@ -16,7 +16,7 @@
};

mobile.boot.stage-1 = {
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
kernel.package = pkgs.callPackage ./kernel { };
};

mobile.system.android.bootimg = {
Expand Down
33 changes: 3 additions & 30 deletions devices/asus-flo/kernel/default.nix
@@ -1,15 +1,12 @@
{
mobile-nixos
, fetchFromGitHub
, kernelPatches ? [] # FIXME
}:

(mobile-nixos.kernel-builder-gcc6 {
mobile-nixos.kernel-builder-gcc6 {
version = "3.4.113";
configfile = ./config.armv7;

file = "zImage";

src = fetchFromGitHub {
owner = "LineageOS";
repo = "android_kernel_google_msm";
Expand All @@ -27,30 +24,6 @@
./99_framebuffer.patch
];

enableCompilerGcc6Quirk = true;
isModular = false;

postPatch = ''
cp -v "${./compiler-gcc6.h}" "./include/linux/compiler-gcc6.h"
'';
}).overrideAttrs({ postInstall ? "", ... }: {
installTargets = [ "zinstall" ];
postInstall = postInstall + ''
mkdir -p "$out/boot"

# FIXME factor this out properly
# Copies all potential output files.
for f in zImage-dtb Image.gz-dtb zImage Image.gz Image; do
f=arch/arm/boot/$f
[ -e "$f" ] || continue
echo "zImage found: $f"
cp -v "$f" "$out/"
break
done

mkdir -p $out/dtb
for f in arch/*/boot/dts/*.dtb; do
cp -v "$f" $out/dtb/
done

'';
})
}
2 changes: 1 addition & 1 deletion devices/asus-x018d/default.nix
Expand Up @@ -17,7 +17,7 @@
};

mobile.boot.stage-1 = {
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
kernel.package = pkgs.callPackage ./kernel { };
};

mobile.system.android = {
Expand Down
29 changes: 5 additions & 24 deletions devices/asus-x018d/kernel/default.nix
@@ -1,21 +1,14 @@
{
mobile-nixos
, fetchFromGitHub
, kernelPatches ? [] # FIXME
, python2
, buildPackages
}:

let
inherit (buildPackages) dtc;
in
(mobile-nixos.kernel-builder-gcc49 {
mobile-nixos.kernel-builder-gcc49 {
version = "3.18.35";
configfile = ./config.aarch64;

file = "Image.gz-dtb";
hasDTB = true;

src = fetchFromGitHub {
owner = "mobile-nixos";
repo = "linux";
Expand All @@ -32,23 +25,11 @@ in
./0002-E262L-Green-LED-now-defaults-to-on.patch
];

makeFlags = [
"DTC_EXT=${dtc}/bin/dtc"
];

isModular = false;

postPatch = ''
patchShebangs tools
'';

nativeBuildInputs = [
# Needed for tools/dct/DrvGen.py
python2
];
}).overrideAttrs({ postInstall ? "", ... }: {
installTargets = [ "zinstall" "Image.gz-dtb" "install" ];

postInstall = postInstall + ''
cp -v "$buildRoot/arch/arm64/boot/Image.gz-dtb" "$out/"
'';
})
isImageGzDtb = true;
isModular = false;
}
3 changes: 1 addition & 2 deletions devices/asus-z00t/default.nix
Expand Up @@ -19,13 +19,12 @@
};

mobile.boot.stage-1 = {
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
kernel.package = pkgs.callPackage ./kernel { };
};

mobile.device.firmware = pkgs.callPackage ./firmware {};

mobile.system.android.bootimg = {
dt = "${config.mobile.boot.stage-1.kernel.package}/dtbs/asus-z00t.img";
flash = {
offset_base = "0x10000000";
offset_kernel = "0x00008000";
Expand Down
69 changes: 0 additions & 69 deletions devices/asus-z00t/kernel/compiler-gcc6.h

This file was deleted.

33 changes: 4 additions & 29 deletions devices/asus-z00t/kernel/default.nix
@@ -1,17 +1,12 @@
{
mobile-nixos
, fetchFromGitHub
, kernelPatches ? [] # FIXME
, dtbTool
}:

(mobile-nixos.kernel-builder-gcc6 {
mobile-nixos.kernel-builder-gcc6 {
version = "3.10.108";
configfile = ./config.aarch64;

file = "Image.gz";
hasDTB = true;

src = fetchFromGitHub {
owner = "LineageOS";
repo = "android_kernel_asus_msm8916";
Expand Down Expand Up @@ -40,27 +35,7 @@
./90_dtbs-install.patch
./99_framebuffer.patch
];

qcdt_dtbs = "arch/arm/boot/";
isModular = false;

postPatch = ''
cp -v "${./compiler-gcc6.h}" "./include/linux/compiler-gcc6.h"
'';
}).overrideAttrs({ postInstall ? "", ... }: {
installTargets = [ "zinstall" ];
postInstall = postInstall + ''
${dtbTool}/bin/dtbTool -s 2048 -p "scripts/dtc/" -o "arch/arm64/boot/asus-z00t.img" "arch/arm/boot/"
cp "arch/arm64/boot/asus-z00t.img" "$out/dtbs/asus-z00t.img"

mkdir -p $out/dtb
for f in arch/*/boot/dts/*.dtb; do
cp -v "$f" $out/dtb/
done

# # FIXME: understand the specifics of why this needs to be catted together.
# (
# cd $out
# cat Image.gz dtb/*.dtb > vmlinuz-dtb
# )
'';
})
isQcdt = true;
}
2 changes: 1 addition & 1 deletion devices/google-marlin/default.nix
Expand Up @@ -16,7 +16,7 @@
};

mobile.boot.stage-1 = {
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
kernel.package = pkgs.callPackage ./kernel { };
};

mobile.system.android = {
Expand Down
41 changes: 4 additions & 37 deletions devices/google-marlin/kernel/default.nix
@@ -1,20 +1,11 @@
{
mobile-nixos
, fetchFromGitHub
, kernelPatches ? [] # FIXME
, buildPackages
}:

let
inherit (buildPackages) dtc;
in

(mobile-nixos.kernel-builder-gcc6 {
mobile-nixos.kernel-builder-gcc6 {
configfile = ./config.aarch64;

file = "Image.gz-dtb";
hasDTB = true;

version = "3.18.140";
src = fetchFromGitHub {
owner = "android-linux-stable";
Expand All @@ -29,31 +20,7 @@ in
./99_framebuffer.patch
];

enableRemovingWerror = true;
isImageGzDtb = true;
isModular = false;

postPatch = ''
# FIXME : factor out
(
# Remove -Werror from all makefiles
local i
local makefiles="$(find . -type f -name Makefile)
$(find . -type f -name Kbuild)"
for i in $makefiles; do
sed -i 's/-Werror-/-W/g' "$i"
sed -i 's/-Werror=/-W/g' "$i"
sed -i 's/-Werror//g' "$i"
done
)

# Remove google's default dm-verity certs
rm -f *.x509
'';
}).overrideAttrs({ postInstall ? "", nativeBuildInputs, ... }: {
installTargets = [ "zinstall" "Image.gz-dtb" "install" ];

nativeBuildInputs = nativeBuildInputs ++ [ dtc ];

postInstall = postInstall + ''
cp -v "$buildRoot/arch/arm64/boot/Image.gz-dtb" "$out/"
'';
})
}
2 changes: 1 addition & 1 deletion devices/google-walleye/default.nix
Expand Up @@ -16,7 +16,7 @@
};

mobile.boot.stage-1 = {
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
kernel.package = pkgs.callPackage ./kernel { };
};

mobile.system.android = {
Expand Down