mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-28 10:26:55 +03:00
Adds Asus Z00T kernel
This commit is contained in:
parent
81ce8dd965
commit
2bd88ab30e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.swp
|
68
overlay/asus-z00t/01_fix_gcc6_errors.patch
Normal file
68
overlay/asus-z00t/01_fix_gcc6_errors.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From 44f841be2a223d672eaf9fa3029fd9249aeca583 Mon Sep 17 00:00:00 2001
|
||||
From: MOVZX <movzx@yahoo.com>
|
||||
Date: Tue, 25 Apr 2017 17:04:40 +0300
|
||||
Subject: [PATCH] prima: Fix GCC6 Warnings
|
||||
|
||||
Signed-off-by: MOVZX <movzx@yahoo.com>
|
||||
---
|
||||
drivers/staging/prima/CORE/MAC/src/include/utilsApi.h | 2 +-
|
||||
drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c | 2 +-
|
||||
drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c | 2 +-
|
||||
drivers/staging/prima/CORE/VOSS/src/wlan_nv_template_builtin.c | 5 ++---
|
||||
4 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h b/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
|
||||
index 3a175473378..798a05cd2b4 100644
|
||||
--- a/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
|
||||
+++ b/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
|
||||
@@ -705,7 +705,7 @@ halRoundS32(tANI_S32 p)
|
||||
else
|
||||
k = p;
|
||||
|
||||
- return(k);
|
||||
+ return(k);
|
||||
}
|
||||
|
||||
// New functions for endianess conversion
|
||||
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
|
||||
index 0fc798995ae..6427a04e108 100644
|
||||
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
|
||||
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
|
||||
@@ -60,7 +60,7 @@
|
||||
// Temporarily (maybe for all of Alpha-1), assuming TIM = 0
|
||||
//
|
||||
|
||||
-const tANI_U8 P2pOui[] = {0x50, 0x6F, 0x9A, 0x9};
|
||||
+tANI_U8 P2pOui[] = {0x50, 0x6F, 0x9A, 0x9};
|
||||
|
||||
|
||||
tSirRetStatus schGetP2pIeOffset(tANI_U8 *pExtraIe, tANI_U32 extraIeLen, tANI_U16 *pP2pIeOffset)
|
||||
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
|
||||
index 23ab858c355..b4f26def1d1 100644
|
||||
--- a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
|
||||
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
|
||||
@@ -5698,7 +5698,7 @@ static tANI_BOOLEAN csrScanProcessScanResults( tpAniSirGlobal pMac, tSmeCmd *pCo
|
||||
if (eHAL_STATUS_SUCCESS != status)
|
||||
smsLog(pMac, LOGE,
|
||||
FL( "failed to update the supported channel list"));
|
||||
- pMac->scan.defer_update_channel_list = false;
|
||||
+ pMac->scan.defer_update_channel_list = false;
|
||||
}
|
||||
|
||||
#ifdef WLAN_AP_STA_CONCURRENCY
|
||||
diff --git a/drivers/staging/prima/CORE/VOSS/src/wlan_nv_template_builtin.c b/drivers/staging/prima/CORE/VOSS/src/wlan_nv_template_builtin.c
|
||||
index 14c6eadf524..e26b697f793 100644
|
||||
--- a/drivers/staging/prima/CORE/VOSS/src/wlan_nv_template_builtin.c
|
||||
+++ b/drivers/staging/prima/CORE/VOSS/src/wlan_nv_template_builtin.c
|
||||
@@ -587,9 +587,8 @@ _NV_TEMPLATE_TABLE NvTablesBuiltIn[/*TABLES_MAX*/][TABLE_ENTRIES_MAX] = {
|
||||
((char *)&(nvDefaults.tables.hwCalValues.calData.psSlpTimeOvrHdxLNA5G) -
|
||||
(char *)&nvDefaults.tables.hwCalValues.calData),"psSlpTimeOvrHdxLNA5G"},
|
||||
{"ed",_ID_U8,SINGULAR,0,0,0,
|
||||
- (((char *)&(nvDefaults.tables.hwCalValues.calData.psSlpTimeOvrHdxLNA5G) +
|
||||
- sizeof(uint16)) - (char *)&nvDefaults.tables.hwCalValues.calData),
|
||||
- "nv_TxBBFSel9MHz"},
|
||||
+ ((char *)&(nvDefaults.tables.hwCalValues.calData.psSlpTimeOvrHdxLNA5G) -
|
||||
+ (char *)&nvDefaults.tables.hwCalValues.calData),"nv_TxBBFSel9MHz"},
|
||||
{"ee",_ID_U8,SINGULAR,0,0,0,
|
||||
((char *)&(nvDefaults.tables.hwCalValues.calData.hwParam2) -
|
||||
(char *)&nvDefaults.tables.hwCalValues.calData),"hwParam2"},
|
13
overlay/asus-z00t/02_mdss_fb_refresh_rate.patch
Normal file
13
overlay/asus-z00t/02_mdss_fb_refresh_rate.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
|
||||
index b37fd1e07ac1..1f091a261d22 100644
|
||||
--- a/drivers/video/msm/mdss/mdss_fb.c
|
||||
+++ b/drivers/video/msm/mdss/mdss_fb.c
|
||||
@@ -2668,7 +2668,7 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
|
||||
var->left_margin = panel_info->lcdc.h_back_porch;
|
||||
var->right_margin = panel_info->lcdc.h_front_porch;
|
||||
var->hsync_len = panel_info->lcdc.h_pulse_width;
|
||||
- var->pixclock = panel_info->clk_rate / 1000;
|
||||
+ var->pixclock = 1000000 / 60;
|
||||
|
||||
/*
|
||||
* Store the cont splash state in the var reserved[3] field.
|
52
overlay/asus-z00t/05_dtb-fix.patch
Normal file
52
overlay/asus-z00t/05_dtb-fix.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From e4e4f1f704b97a57edbbe471962729e2efd04fd6 Mon Sep 17 00:00:00 2001
|
||||
From: rishabhrao <admin@rishabhrao.net>
|
||||
Date: Sun, 5 Feb 2017 07:44:00 +0000
|
||||
Subject: [PATCH] s2: Fix Kernel Standalone Building Errors
|
||||
|
||||
Change-Id: Ia54b1b5e3ba950a8ac0db689275dd760455cdfad
|
||||
Signed-off-by: rishabhrao <admin@rishabhrao.net>
|
||||
---
|
||||
arch/arm64/Makefile | 7 ++++---
|
||||
arch/arm64/boot/Makefile | 2 +-
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
|
||||
index 153e8545587..bdc365eb4d6 100644
|
||||
--- a/arch/arm64/Makefile
|
||||
+++ b/arch/arm64/Makefile
|
||||
@@ -61,6 +61,7 @@ KBUILD_DTBS := dtbs
|
||||
|
||||
all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
|
||||
|
||||
+boot32 := arch/arm/boot
|
||||
boot := arch/arm64/boot
|
||||
|
||||
Image Image.gz: vmlinux
|
||||
@@ -70,11 +71,11 @@ zinstall install: vmlinux
|
||||
$(Q)$(MAKE) $(build)=$(boot) $@
|
||||
|
||||
%.dtb: scripts
|
||||
- $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
|
||||
+ $(Q)$(MAKE) $(build)=$(boot32)/dts $(boot32)/dts/$@
|
||||
|
||||
dtbs: scripts
|
||||
- $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
|
||||
- $(Q)$(MAKE) $(build)=$(boot)/dts/qcom dtbs
|
||||
+ $(Q)$(MAKE) $(build)=$(boot32)/dts dtbs
|
||||
+ $(Q)$(MAKE) $(build)=$(boot32)/dts/qcom dtbs
|
||||
|
||||
PHONY += vdso_install
|
||||
vdso_install:
|
||||
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
|
||||
index ad85404a64d..b49defdf14a 100644
|
||||
--- a/arch/arm64/boot/Makefile
|
||||
+++ b/arch/arm64/boot/Makefile
|
||||
@@ -24,7 +24,7 @@ DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
|
||||
else
|
||||
DTB_LIST := $(dtb-y)
|
||||
endif
|
||||
-DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST))
|
||||
+DTB_OBJS := $(addprefix $(srctree)/arch/arm/boot/dts/,$(DTB_LIST))
|
||||
|
||||
$(obj)/Image: vmlinux FORCE
|
||||
$(call if_changed,objcopy)
|
77
overlay/asus-z00t/90_dtbs-install.patch
Normal file
77
overlay/asus-z00t/90_dtbs-install.patch
Normal file
@ -0,0 +1,77 @@
|
||||
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
|
||||
index 644ef3ed222..dd1c141c36a 100644
|
||||
--- a/arch/arm64/Makefile
|
||||
+++ b/arch/arm64/Makefile
|
||||
@@ -76,6 +76,9 @@ dtbs: scripts
|
||||
$(Q)$(MAKE) $(build)=$(boot)/dts dtbs
|
||||
$(Q)$(MAKE) $(build)=$(boot)/dts/qcom dtbs
|
||||
|
||||
+dtbs_install:
|
||||
+ $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
|
||||
+
|
||||
PHONY += vdso_install
|
||||
vdso_install:
|
||||
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
|
||||
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
|
||||
index 547e15daf03..8606bf2685c 100644
|
||||
--- a/scripts/Kbuild.include
|
||||
+++ b/scripts/Kbuild.include
|
||||
@@ -169,6 +169,12 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
|
||||
# $(Q)$(MAKE) $(modbuiltin)=dir
|
||||
modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
|
||||
|
||||
+###
|
||||
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
|
||||
+# Usage:
|
||||
+# $(Q)$(MAKE) $(dtbinst)=dir
|
||||
+dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj
|
||||
+
|
||||
# Prefix -I with $(srctree) if it is not an absolute path.
|
||||
# skip if -I has no parameter
|
||||
addtree = $(if $(patsubst -I%,%,$(1)), \
|
||||
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
|
||||
new file mode 100644
|
||||
index 00000000000..7301ab5e2e0
|
||||
--- /dev/null
|
||||
+++ b/scripts/Makefile.dtbinst
|
||||
@@ -0,0 +1,40 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+# ==========================================================================
|
||||
+# Installing dtb files
|
||||
+#
|
||||
+# Installs all dtb files listed in $(dtb-y) either in the
|
||||
+# INSTALL_DTBS_PATH directory or the default location:
|
||||
+#
|
||||
+# $INSTALL_PATH/dtbs/$KERNELRELEASE
|
||||
+# ==========================================================================
|
||||
+
|
||||
+src := $(obj)
|
||||
+
|
||||
+PHONY := __dtbs_install
|
||||
+__dtbs_install:
|
||||
+
|
||||
+export dtbinst_root ?= $(obj)
|
||||
+
|
||||
+include include/config/auto.conf
|
||||
+include scripts/Kbuild.include
|
||||
+include $(src)/Makefile
|
||||
+
|
||||
+dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
|
||||
+dtbinst-dirs := $(subdir-y) $(subdir-m)
|
||||
+
|
||||
+# Helper targets for Installing DTBs into the boot directory
|
||||
+quiet_cmd_dtb_install = INSTALL $<
|
||||
+ cmd_dtb_install = mkdir -p $(2); cp $< $(2)
|
||||
+
|
||||
+install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
|
||||
+
|
||||
+$(dtbinst-files): %.dtb: $(obj)/%.dtb
|
||||
+ $(call cmd,dtb_install,$(install-dir))
|
||||
+
|
||||
+$(dtbinst-dirs):
|
||||
+ $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
|
||||
+
|
||||
+PHONY += $(dtbinst-files) $(dtbinst-dirs)
|
||||
+__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
|
||||
+
|
||||
+.PHONY: $(PHONY)
|
69
overlay/asus-z00t/compiler-gcc6.h
Normal file
69
overlay/asus-z00t/compiler-gcc6.h
Normal file
@ -0,0 +1,69 @@
|
||||
// SOURCE:
|
||||
// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505
|
||||
|
||||
#ifndef __LINUX_COMPILER_H
|
||||
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
|
||||
#endif
|
||||
|
||||
#define __used __attribute__((__used__))
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
||||
|
||||
/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
to them will be unlikely. This means a lot of manual unlikely()s
|
||||
are unnecessary now for any paths leading to the usual suspects
|
||||
like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
older compilers]
|
||||
|
||||
Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
in the preprocessor, but we can live with this because they're unreleased.
|
||||
Maketime probing would be overkill here.
|
||||
|
||||
gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
a special section, but I don't see any sense in this right now in
|
||||
the kernel context */
|
||||
#define __cold __attribute__((__cold__))
|
||||
|
||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
|
||||
#ifndef __CHECKER__
|
||||
# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
# define __compiletime_error(message) __attribute__((error(message)))
|
||||
#endif /* __CHECKER__ */
|
||||
|
||||
/*
|
||||
* Mark a position in code as unreachable. This can be used to
|
||||
* suppress control flow warnings after asm blocks that transfer
|
||||
* control elsewhere.
|
||||
*
|
||||
* Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
* this in the preprocessor, but we can live with this because they're
|
||||
* unreleased. Really, we need to have autoconf for the kernel.
|
||||
*/
|
||||
#define unreachable() __builtin_unreachable()
|
||||
|
||||
/* Mark a function definition as prohibited from being cloned. */
|
||||
#define __noclone __attribute__((__noclone__))
|
||||
|
||||
/*
|
||||
* Tell the optimizer that something else uses this function or variable.
|
||||
*/
|
||||
#define __visible __attribute__((externally_visible))
|
||||
|
||||
/*
|
||||
* GCC 'asm goto' miscompiles certain code sequences:
|
||||
*
|
||||
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
*
|
||||
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
*
|
||||
* (asm goto is automatically volatile - the naming reflects this.)
|
||||
*/
|
||||
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
#define __HAVE_BUILTIN_BSWAP32__
|
||||
#define __HAVE_BUILTIN_BSWAP64__
|
||||
#define __HAVE_BUILTIN_BSWAP16__
|
||||
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
|
4223
overlay/asus-z00t/config-asus-z00t.aarch64
Normal file
4223
overlay/asus-z00t/config-asus-z00t.aarch64
Normal file
File diff suppressed because it is too large
Load Diff
141
overlay/asus-z00t/default.nix
Normal file
141
overlay/asus-z00t/default.nix
Normal file
@ -0,0 +1,141 @@
|
||||
{ stdenv, hostPlatform
|
||||
, overrideCC
|
||||
, gcc6
|
||||
, fetchurl
|
||||
, fetchFromGitHub
|
||||
, linuxManualConfig
|
||||
, firmwareLinuxNonfree
|
||||
, bison, flex
|
||||
, binutils-unwrapped
|
||||
, dtbTool
|
||||
, kernelPatches ? [] }:
|
||||
|
||||
# Inspired by https://github.com/thefloweringash/rock64-nix/blob/master/packages/linux_ayufan_4_4.nix
|
||||
# Then in turn inspired by the postmarketos APKBUILDs.
|
||||
|
||||
let
|
||||
modDirVersion = "3.10.108";
|
||||
#withAdditionalFirmware = stdenv.mkDerivation rec {
|
||||
# brcmfmac4356-pcie_txt = fetchurl {
|
||||
# url = "https://raw.githubusercontent.com/andir/nixos-gpd-pocket/master/firmware/brcmfmac4356-pcie.txt";
|
||||
# sha256 = "1v44f7y8pxqw3xmk2v43ny5lhjg6lpch2alry40pdzq56pnplypi";
|
||||
# };
|
||||
# name = "plus-extra--${firmwareLinuxNonfree.name}";
|
||||
# src = firmwareLinuxNonfree;
|
||||
# dontBuild = true;
|
||||
# installPhase = ''
|
||||
# cp -prf . $out
|
||||
# cp ${brcmfmac4356-pcie_txt} $out/lib/firmware/brcm/brcmfmac4356-pcie.txt
|
||||
# '';
|
||||
#};
|
||||
|
||||
version = "${modDirVersion}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "LineageOS";
|
||||
repo = "android_kernel_asus_msm8916";
|
||||
rev = "5fd66aa9219bf9aaa504aa3cb2dae7a3de5238f7";
|
||||
sha256 = "1f2ynnkaxdcm8w3846fd7a304m08fqlpv78mlkdg92fjczw261vx";
|
||||
};
|
||||
patches = [
|
||||
./01_fix_gcc6_errors.patch
|
||||
./02_mdss_fb_refresh_rate.patch
|
||||
./05_dtb-fix.patch
|
||||
./90_dtbs-install.patch
|
||||
];
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
cp -v "${./compiler-gcc6.h}" "./include/linux/compiler-gcc6.h"
|
||||
|
||||
# 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//g' "$i"
|
||||
done
|
||||
echo "Patched out -Werror"
|
||||
'';
|
||||
|
||||
additionalInstall = ''
|
||||
# Generate master DTB (deviceinfo_bootimg_qcdt)
|
||||
${dtbTool}/bin/dtbTool -s 2048 -p "scripts/dtc/" -o "arch/arm64/boot/dt.img" "arch/arm/boot/"
|
||||
|
||||
mkdir -p "$out/boot"
|
||||
cp "arch/arm64/boot/dt.img" \
|
||||
"$out/boot/dt.img"
|
||||
|
||||
# Copies all potential output files.
|
||||
for f in zImage-dtb Image.gz-dtb; do
|
||||
#*zImage Image.gz Image; do
|
||||
f=arch/arm64/boot/$f
|
||||
[ -e "$f" ] || continue
|
||||
echo "zImage found: $f"
|
||||
cp -v "$f" "$out/"
|
||||
done
|
||||
|
||||
# Copies the dtb, could always be useful.
|
||||
mkdir -p $out/dtb
|
||||
for f in arch/*/boot/dts/*.dtb; do
|
||||
cp -v "$f" $out/dtb/
|
||||
done
|
||||
|
||||
# Copies the .config file to output.
|
||||
# Helps ensuring sanity.
|
||||
cp -v .config $out/src.config
|
||||
|
||||
# Finally, makes Image.gz-dtb image ourselves.
|
||||
# Somehow the build system has issues.
|
||||
(
|
||||
cd $out
|
||||
cat Image.gz dtb/*.dtb > Image.gz-dtb
|
||||
)
|
||||
'';
|
||||
in
|
||||
let
|
||||
buildLinux = (args: (linuxManualConfig args).overrideAttrs ({ makeFlags, postInstall, ... }: {
|
||||
inherit patches postPatch;
|
||||
postInstall = ''
|
||||
${postInstall}
|
||||
|
||||
${additionalInstall}
|
||||
'';
|
||||
installTargets = [ "dtbs" "zinstall" ];
|
||||
dontStrip = true;
|
||||
}));
|
||||
|
||||
configfile = stdenv.mkDerivation {
|
||||
name = "android-asus-z00t-config-${modDirVersion}";
|
||||
inherit version;
|
||||
inherit src patches postPatch;
|
||||
nativeBuildInputs = [bison flex];
|
||||
|
||||
buildPhase = ''
|
||||
echo "building config file"
|
||||
cp -v ${./config-asus-z00t.aarch64} .config
|
||||
yes "" | make $makeFlags "''${makeFlagsArray[@]}" oldconfig || :
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# FIXME ?
|
||||
#substituteInPlace .config --replace \
|
||||
# /lib/firmware \
|
||||
# "$ {withAdditionalFirmware}/lib/firmware"
|
||||
cp -v .config $out
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
buildLinux {
|
||||
inherit kernelPatches;
|
||||
inherit hostPlatform;
|
||||
inherit src;
|
||||
inherit version;
|
||||
inherit modDirVersion;
|
||||
inherit configfile;
|
||||
stdenv = overrideCC stdenv gcc6;
|
||||
|
||||
allowImportFromDerivation = true;
|
||||
}
|
11
overlay/default.nix
Normal file
11
overlay/default.nix
Normal file
@ -0,0 +1,11 @@
|
||||
# This defines the mobile-nixos "overlay" which is
|
||||
# basically a known channel + this overlay defined
|
||||
# in overlay.nix.
|
||||
#
|
||||
# Every derivations building a boot image and or a
|
||||
# complete system will import this file somehow.
|
||||
(import (fetchTarball channel:nixos-unstable)) {
|
||||
overlays = [
|
||||
(import ./overlay.nix)
|
||||
];
|
||||
}
|
13
overlay/dtbtool/00_fix_version_detection.patch
Normal file
13
overlay/dtbtool/00_fix_version_detection.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/dtbTool b/dtbTool
|
||||
index b11402d..2dcdd87 100755
|
||||
--- a/dtbTool
|
||||
+++ b/dtbTool
|
||||
@@ -353,7 +353,7 @@ def generate_records(f, pagesize):
|
||||
board_id = fdt_get_property_int(blob, 0, "qcom,board-id")
|
||||
pmic_id = fdt_get_property_int(blob, 0, "qcom,pmic-id")
|
||||
|
||||
- if board_id:
|
||||
+ if board_id and msm_id:
|
||||
x = iter(board_id)
|
||||
board_id = list(zip(x, x))
|
||||
x = iter(msm_id)
|
33
overlay/dtbtool/01_find_dtb_in_subfolders.patch
Normal file
33
overlay/dtbtool/01_find_dtb_in_subfolders.patch
Normal file
@ -0,0 +1,33 @@
|
||||
diff --git a/dtbTool b/dtbTool
|
||||
index 2dcdd87..0c14a94 100644
|
||||
--- a/dtbTool
|
||||
+++ b/dtbTool
|
||||
@@ -408,6 +408,16 @@ def write_padding(f, pagesize):
|
||||
if count != pagesize:
|
||||
output.write(b"".join([b'\x00' for x in range(count)]))
|
||||
|
||||
+def find_dtb(indir):
|
||||
+ flist = list()
|
||||
+ for f in os.listdir(indir):
|
||||
+ ff = os.path.join(indir, f)
|
||||
+ if os.path.isfile(ff) and ff.endswith('.dtb'):
|
||||
+ flist.append(ff)
|
||||
+ elif os.path.isdir(ff):
|
||||
+ flist.extend(find_dtb(ff))
|
||||
+ return flist
|
||||
+
|
||||
if __name__ == "__main__":
|
||||
usage = ("""%prog -o <output file> <input DTB directory> [options]""")
|
||||
parser = OptionParser(usage=usage)
|
||||
@@ -434,10 +444,7 @@ if __name__ == "__main__":
|
||||
|
||||
pagesize = options.pagesize
|
||||
indir = args[0]
|
||||
- flist = [os.path.join(indir, f)
|
||||
- for f in os.listdir(indir)
|
||||
- if os.path.isfile(os.path.join(indir, f)) and
|
||||
- f.endswith('.dtb')]
|
||||
+ flist = find_dtb(indir)
|
||||
|
||||
records = []
|
||||
for f in flist:
|
43
overlay/dtbtool/default.nix
Normal file
43
overlay/dtbtool/default.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{stdenv, fetchurl, python2, dtc, python2Packages}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "dtbtool";
|
||||
version = "1.6.0";
|
||||
src = fetchurl {
|
||||
url = "https://source.codeaurora.org/quic/kernel/skales/plain/dtbTool?id=1.6.0";
|
||||
sha256 = "0lbzpqbar0fr9y53v95v0yrrn2pnm8m1wj43h3l83f7awqma68x2";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./00_fix_version_detection.patch
|
||||
./01_find_dtb_in_subfolders.patch
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
python2
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
python2Packages.wrapPython
|
||||
dtc
|
||||
];
|
||||
|
||||
pythonPath = [ dtc ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace dtbTool \
|
||||
--replace "libfdt.so" "${dtc}/lib/libfdt.so"
|
||||
'';
|
||||
|
||||
unpackCmd = "mkdir out; cp $curSrc out/dtbTool";
|
||||
|
||||
installPhase = ''
|
||||
patchShebangs ./
|
||||
mkdir -p $out/bin
|
||||
cp -v dtbTool $out/bin/
|
||||
chmod +x $out/bin/dtbTool
|
||||
wrapPythonPrograms
|
||||
'';
|
||||
|
||||
# TODO meta url : https://source.codeaurora.org/quic/kernel/skales/plain/dtbTool
|
||||
}
|
26
overlay/mkbootimg/default.nix
Normal file
26
overlay/mkbootimg/default.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{stdenv, fetchurl, python2, dtc, python2Packages}:
|
||||
|
||||
let
|
||||
version = "2017.12.13";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit version;
|
||||
name = "mkbootimg";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/osm0sis/mkbootimg/archive/${version}.tar.gz";
|
||||
sha256 = "1wyn0a2nxwyz3j6yx4vmm67inrsh83h24sfig6y7ww249miix2xp";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp -v mkbootimg $out/bin/
|
||||
cp -v unpackbootimg $out/bin/
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
|
||||
# TODO meta url : https://source.codeaurora.org/quic/kernel/skales/plain/dtbTool
|
||||
}
|
20
overlay/overlay.nix
Normal file
20
overlay/overlay.nix
Normal file
@ -0,0 +1,20 @@
|
||||
self: super:
|
||||
|
||||
let
|
||||
callPackage = self.callPackage;
|
||||
in
|
||||
{
|
||||
linux_asus_z00t = callPackage ./asus-z00t {
|
||||
kernelPatches = with self.kernelPatches; [
|
||||
bridge_stp_helper
|
||||
p9_fixes
|
||||
lguest_entry-linkage
|
||||
packet_fix_race_condition_CVE_2016_8655
|
||||
DCCP_double_free_vulnerability_CVE-2017-6074
|
||||
];
|
||||
};
|
||||
|
||||
dtbTool = callPackage ./dtbtool { };
|
||||
|
||||
mkbootimg = callPackage ./mkbootimg { };
|
||||
}
|
Loading…
Reference in New Issue
Block a user