1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-11-04 01:09:37 +03:00

device: add lg-hammerhead

This commit is contained in:
0x4A6F 2019-09-04 20:52:14 +00:00
parent 190619e4e6
commit 138cc1d3d6
No known key found for this signature in database
GPG Key ID: 8DEDBA5BE07080E1
6 changed files with 6184 additions and 0 deletions

View File

@ -0,0 +1,44 @@
{ config, lib, pkgs, ... }:
{
mobile.device.name = "lg-hammerhead";
mobile.device.info = rec {
format_version="0";
name="Google Nexus 5";
manufacturer="LG";
codename="lg-hammerhead";
date="";
keyboard="false";
nonfree="false";
append_dtb="true";
modules_initfs="";
external_storage="false";
flash_method="fastboot";
arch="armv7";
# Fastboot related
generate_bootimg="true";
flash_offset_base="0";
flash_offset_kernel="0x00008000";
flash_offset_ramdisk="0x2900000";
flash_offset_second="0x00f00000";
flash_offset_tags="0x02700000";
kernel_cmdline="console=tty0 console=ttyMSM0,115200,n8";
flash_pagesize="2048";
dev_touchscreen = "";
dev_touchscreen_calibration = "";
dev_keyboard = "";
bootimg_qcdt = true;
# TODO : make kernel part of options.
kernel = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
dtb = "${kernel}/dtbs/qcom-msm8974-lge-nexus5-hammerhead.dtb";
};
mobile.hardware = {
soc = "qualcomm-msm8974";
ram = 1024 * 2;
screen = {
width = 1080; height = 1920;
};
};
mobile.system.type = "android";
}

View 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 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
{
mobile-nixos
, fetchFromGitHub
, fetchgit
, kernelPatches ? [] # FIXME
}:
(mobile-nixos.kernel-builder {
version = "5.2.0";
configfile = ./config.armv7;
file = "zImage";
hasDTB = true;
src = fetchFromGitHub {
owner = "masneyb";
repo = "linux";
rev = "33fee68163e501634338b40aac2ebe279bf7787b";
sha256 = "1n40vcd4gdppg29n63asbvasd0ybcwldmi044kk9j0lrksga1p5d";
};
patches = [
# ./90_dtbs-install.patch
# ./99_framebuffer.patch
];
isModular = false;
}).overrideAttrs({ postInstall ? "", postPatch ? "", ... }: {
installTargets = [ "zinstall" ];
postPatch = postPatch + ''
cp -v "${./compiler-gcc6.h}" "./include/linux/compiler-gcc6.h"
'';
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
'';
})

View File

@ -0,0 +1,31 @@
partx -s /dev/block/mmcblk0
NR START END SECTORS SIZE NAME UUID
1 1024 132095 131072 64M modem 00000000-0000-0000-0000-000000000000
2 132096 134143 2048 1M sbl1 00000000-0000-0000-0000-000000000000
3 134144 135167 1024 512K rpm 00000000-0000-0000-0000-000000000000
4 135168 136191 1024 512K tz 00000000-0000-0000-0000-000000000000
5 136192 137215 1024 512K sdi 00000000-0000-0000-0000-000000000000
6 137216 138239 1024 512K aboot 00000000-0000-0000-0000-000000000000
7 138240 142335 4096 2M pad 00000000-0000-0000-0000-000000000000
8 142336 144383 2048 1M sbl1b 00000000-0000-0000-0000-000000000000
9 144384 145407 1024 512K tzb 00000000-0000-0000-0000-000000000000
10 145408 146431 1024 512K rpmb 00000000-0000-0000-0000-000000000000
11 146432 147455 1024 512K abootb 00000000-0000-0000-0000-000000000000
12 147456 153599 6144 3M modemst 00000000-0000-0000-0000-000000000000
13 153600 159743 6144 3M modemst 00000000-0000-0000-0000-000000000000
14 159744 160767 1024 512K metadat 00000000-0000-0000-0000-000000000000
15 160768 193535 32768 16M misc 00000000-0000-0000-0000-000000000000
16 193536 226303 32768 16M persist 00000000-0000-0000-0000-000000000000
17 226304 232447 6144 3M imgdata 00000000-0000-0000-0000-000000000000
18 232448 277503 45056 22M laf 00000000-0000-0000-0000-000000000000
19 277504 322559 45056 22M boot 00000000-0000-0000-0000-000000000000
20 322560 367615 45056 22M recover 00000000-0000-0000-0000-000000000000
21 367616 373759 6144 3M fsg 00000000-0000-0000-0000-000000000000
22 373760 374783 1024 512K fsc 00000000-0000-0000-0000-000000000000
23 374784 375807 1024 512K ssd 00000000-0000-0000-0000-000000000000
24 375808 376831 1024 512K DDR 00000000-0000-0000-0000-000000000000
25 376832 2473983 2097152 1G system 00000000-0000-0000-0000-000000000000
26 2473984 2535423 61440 30M crypto 00000000-0000-0000-0000-000000000000
27 2535424 3969023 1433600 700M cache 00000000-0000-0000-0000-000000000000
28 3969024 61071315 57102292 27.2G userdat 00000000-0000-0000-0000-000000000000
29 61071316 61071326 11 5.5K grow 00000000-0000-0000-0000-000000000000

View File

@ -22,6 +22,11 @@ in
default = false;
description = "enable when SOC is msm8939";
};
hardware.socs.qualcomm-msm8974.enable = mkOption {
type = types.bool;
default = false;
description = "enable when SOC is msm8974";
};
};
config = mkMerge [
@ -37,6 +42,12 @@ in
quirks.qualcomm.msm-fb-handle.enable = true;
};
}
{
mobile = mkIf cfg.qualcomm-msm8974.enable {
system.system = "armv7l-linux";
quirks.qualcomm.msm-fb-refresher.enable = true;
};
}
{
mobile = mkIf cfg.qualcomm-apq8064-1aa.enable {
system.system = "armv7l-linux";