1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-16 11:43:21 +03:00

kernel-builder: implement QCDT configuration in the builder

This commit is contained in:
Samuel Dionne-Riel 2020-10-01 18:56:08 -04:00
parent 62fe1409c6
commit 1889893a43
2 changed files with 28 additions and 0 deletions

View File

@ -130,6 +130,10 @@ in
}; };
}) })
(lib.mkIf kernelPackage.isQcdt {
mobile.system.android.bootimg.dt = "${kernelPackage}/dt.img";
})
{ {
mobile.boot.stage-1.bootConfig = { mobile.boot.stage-1.bootConfig = {
device = { device = {

View File

@ -30,6 +30,7 @@
, libmpc , libmpc
, mpfr , mpfr
, dtc , dtc
, dtbTool
, libelf , libelf
, utillinux , utillinux
@ -65,6 +66,10 @@ in
# Additionally, a config file is required. # Additionally, a config file is required.
, configfile , configfile
# Handling of QCDT dt.img
, isQcdt ? false
, qcdt_dtbs ? "arch/${platform.kernelArch}/boot/"
# Togglable common quirks # Togglable common quirks
, enableCenteredLinuxLogo ? true , enableCenteredLinuxLogo ? true
, enableLinuxLogoReplacement ? true , enableLinuxLogoReplacement ? true
@ -127,6 +132,7 @@ let kernelDerivation =
stdenv.mkDerivation (inputArgs // { stdenv.mkDerivation (inputArgs // {
pname = "linux"; pname = "linux";
inherit src version file; inherit src version file;
inherit qcdt_dtbs;
# Allows disabling the kernel config normalization. # Allows disabling the kernel config normalization.
# Set to false when normalizing the kernel config. # Set to false when normalizing the kernel config.
@ -141,6 +147,7 @@ stdenv.mkDerivation (inputArgs // {
# Mobile NixOS inputs. # Mobile NixOS inputs.
# While some kernels might not need those, most will. # While some kernels might not need those, most will.
++ [ dtc ] ++ [ dtc ]
++ optional isQcdt dtbTool
++ nativeBuildInputs ++ nativeBuildInputs
; ;
@ -309,11 +316,24 @@ stdenv.mkDerivation (inputArgs // {
; ;
postInstall = '' postInstall = ''
echo ":: Copying configuration file"
# Helpful in cases where the kernel isn't built with /proc/config.gz # Helpful in cases where the kernel isn't built with /proc/config.gz
cp -v "$buildRoot/.config" "$out/build.config" cp -v "$buildRoot/.config" "$out/build.config"
'' + optionalString hasDTB '' '' + optionalString hasDTB ''
echo ":: Installing DTBs"
mkdir -p $out/dtbs/ mkdir -p $out/dtbs/
make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs
'' + optionalString isQcdt ''
echo ":: Making and installing QCDT dt.img"
(PS4=" $ "; set -x
mkdir -p $out/
dtbTool -s 2048 -p "scripts/dtc/" \
-o "$out/dt.img" \
"$qcdt_dtbs"
)
'' ''
+ maybeString postInstall + maybeString postInstall
; ;
@ -342,6 +362,10 @@ stdenv.mkDerivation (inputArgs // {
# {{{ # {{{
passthru = { passthru = {
# This is an "API" for the kernel derivation.
inherit isQcdt;
# Derivation with the as-built normalized kernel config
normalizedConfig = kernelDerivation.overrideAttrs({ ... }: { normalizedConfig = kernelDerivation.overrideAttrs({ ... }: {
forceNormalizedConfig = false; forceNormalizedConfig = false;
buildPhase = "echo Skipping build phase..."; buildPhase = "echo Skipping build phase...";