mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-11 09:04:01 +03:00
Merge branch 'device/asus-dumo'
This commit is contained in:
commit
ead49f6897
34
bin/kernel-normalize-config
Executable file
34
bin/kernel-normalize-config
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script is expected to be used to copy back the `kernel-builder` built
|
||||
# linux configuration to the kernel's source directory.
|
||||
#
|
||||
# Use this to normalize the configuration after:
|
||||
#
|
||||
# - Changing configuration options
|
||||
# - Changing the kernel version
|
||||
|
||||
set -e
|
||||
set -u
|
||||
PS4=" $ "
|
||||
|
||||
if (( $# != 2 )); then
|
||||
echo "Usage: bin/kernel-normalize-config <device-name> <output>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
device="$1"; shift
|
||||
out="$1"; shift
|
||||
|
||||
set -x
|
||||
|
||||
build() {
|
||||
nix-build --no-out-link -I nixpkgs="$PWD/nixpkgs" -A config.mobile.device.info.kernel --argstr device "$device"
|
||||
}
|
||||
|
||||
# The first one actively rebuilds to get the config...
|
||||
cp "$(build)/build.config" "$out"
|
||||
# This one rebuilds with the (assumedly) normalized config
|
||||
cp "$(build)/build.config" "$out"
|
||||
# This last copy and build is likely useless. Though it's a quick no-op
|
||||
cp "$(build)/build.config" "$out"
|
28
devices/asus-dumo/default.nix
Normal file
28
devices/asus-dumo/default.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
mobile.device.name = "asus-dumo";
|
||||
mobile.device.info = rec {
|
||||
format_version = "0";
|
||||
name = "ASUS Chromebook Tablet CT100PA";
|
||||
manufacturer = "ASUS";
|
||||
arch = "aarch64";
|
||||
keyboard = false;
|
||||
external_storage = true;
|
||||
# Serial console on ttyS2, using a suzyqable or equivalent.
|
||||
kernel_cmdline = "console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 loglevel=8";
|
||||
# TODO : move kernel outside of the basic device details
|
||||
kernel = pkgs.callPackage ./kernel {};
|
||||
# This could be further pared down to only the required dtb files.
|
||||
dtbs = "${kernel}/dtbs/rockchip";
|
||||
};
|
||||
mobile.hardware = {
|
||||
soc = "rockchip-op1";
|
||||
ram = 1024 * 4;
|
||||
screen = {
|
||||
width = 1536; height = 2048;
|
||||
};
|
||||
};
|
||||
|
||||
mobile.system.type = "depthcharge";
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
From c17ac107ca60bea6bccd7acefe25104dca9923dc Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
||||
Date: Thu, 12 Sep 2019 15:40:28 -0400
|
||||
Subject: [PATCH] HACK: disables hs400es codepath
|
||||
|
||||
This is NOT a good fix. This is only to make the device usable
|
||||
for testing purposes.
|
||||
|
||||
---
|
||||
drivers/mmc/core/mmc.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
|
||||
index c8804895595f..525b90de160d 100644
|
||||
--- a/drivers/mmc/core/mmc.c
|
||||
+++ b/drivers/mmc/core/mmc.c
|
||||
@@ -1500,9 +1500,9 @@ static int mmc_select_timing(struct mmc_card *card)
|
||||
if (!mmc_can_ext_csd(card))
|
||||
goto bus_speed;
|
||||
|
||||
- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
|
||||
+ /*if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
|
||||
err = mmc_select_hs400es(card);
|
||||
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
|
||||
+ else */if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
|
||||
err = mmc_select_hs200(card);
|
||||
else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
|
||||
err = mmc_select_hs(card);
|
||||
--
|
||||
2.19.2
|
||||
|
5611
devices/asus-dumo/kernel/config.aarch64
Normal file
5611
devices/asus-dumo/kernel/config.aarch64
Normal file
File diff suppressed because it is too large
Load Diff
26
devices/asus-dumo/kernel/default.nix
Normal file
26
devices/asus-dumo/kernel/default.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
mobile-nixos
|
||||
, fetchFromGitHub
|
||||
, fetchgit
|
||||
, kernelPatches ? [] # FIXME
|
||||
}:
|
||||
|
||||
(mobile-nixos.kernel-builder {
|
||||
version = "5.3.0";
|
||||
configfile = ./config.aarch64;
|
||||
|
||||
hasDTB = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "torvalds";
|
||||
repo = "linux";
|
||||
rev = "v5.3";
|
||||
sha256 = "1iiv8fim1l4n7n7wkq0x4bf84ygrd1i7zaybmsphswsx1cpb5g6j";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./0001-HACK-disables-hs400es-codepath.patch
|
||||
];
|
||||
|
||||
isModular = false;
|
||||
})
|
24
modules/hardware-rockchip.nix
Normal file
24
modules/hardware-rockchip.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.mobile.hardware.socs;
|
||||
in
|
||||
{
|
||||
options.mobile = {
|
||||
hardware.socs.rockchip-op1.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "enable when SOC is RK3399-OP1";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
mobile = mkIf cfg.rockchip-op1.enable {
|
||||
system.platform = "aarch64-linux";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
@ -9,7 +9,7 @@ in
|
||||
options.mobile.hardware = {
|
||||
soc = mkOption {
|
||||
# This is used to enable a specific SOC on a device, while giving it a name.
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = ''
|
||||
Give the SOC name for the device.
|
||||
'';
|
||||
|
@ -17,7 +17,7 @@ in
|
||||
'';
|
||||
};
|
||||
initialization = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = ''
|
||||
[ -e "/sys/class/graphics/fb0/modes" ] || return
|
||||
[ -z "$(cat /sys/class/graphics/fb0/mode)" ] || return
|
||||
|
@ -27,7 +27,7 @@ in
|
||||
'';
|
||||
};
|
||||
modules = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
];
|
||||
description = ''
|
||||
@ -36,7 +36,7 @@ in
|
||||
'';
|
||||
};
|
||||
additional_modules = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
];
|
||||
description = ''
|
||||
@ -45,7 +45,7 @@ in
|
||||
'';
|
||||
};
|
||||
firmwares = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
Firmwares to add to the cloure.
|
||||
|
@ -24,7 +24,7 @@ in
|
||||
'';
|
||||
};
|
||||
targets = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
description = ''
|
||||
Where the init process logs are redirected to.
|
||||
|
||||
|
@ -19,14 +19,14 @@ in
|
||||
'';
|
||||
};
|
||||
IP = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "172.16.42.1";
|
||||
description = ''
|
||||
IP address for the USB networking gadget.
|
||||
'';
|
||||
};
|
||||
hostIP = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "172.16.42.2";
|
||||
description = ''
|
||||
IP address for the USB networking gadget.
|
||||
|
@ -18,7 +18,7 @@ in
|
||||
'';
|
||||
};
|
||||
console = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "console";
|
||||
description = ''
|
||||
Selects the /dev/___ device to use.
|
||||
|
@ -18,7 +18,7 @@ in
|
||||
'';
|
||||
};
|
||||
features = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
`android_usb` features to enable.
|
||||
|
@ -11,6 +11,7 @@ in
|
||||
./hardware-generic.nix
|
||||
./hardware-qualcomm.nix
|
||||
./hardware-ram.nix
|
||||
./hardware-rockchip.nix
|
||||
./hardware-screen.nix
|
||||
./hardware-soc.nix
|
||||
./initrd-base.nix
|
||||
|
@ -19,6 +19,10 @@ let
|
||||
# XXX : this feels like a hack
|
||||
initrd = pkgs.callPackage ../systems/initrd.nix { inherit device_config stage-1; };
|
||||
};
|
||||
depthcharge = pkgs.callPackage ../systems/depthcharge {
|
||||
inherit device_config;
|
||||
initrd = pkgs.callPackage ../systems/initrd.nix { inherit device_config stage-1; };
|
||||
};
|
||||
kernel-initrd = pkgs.linkFarm "${device_config.name}-build" [
|
||||
{
|
||||
name = "kernel-initrd";
|
||||
|
@ -52,7 +52,7 @@ in
|
||||
|
||||
# Part of the "API" of the kernel builder.
|
||||
# Image builders expect this attribute to know where to find the kernel file.
|
||||
, file ? "Image" # FIXME : make more generic?
|
||||
, file ? stdenv.hostPlatform.platform.kernelTarget
|
||||
|
||||
# FIXME : useful?
|
||||
, isModular ? true
|
||||
|
@ -87,6 +87,14 @@ in
|
||||
) oldAttrs.buildInputs;
|
||||
});
|
||||
|
||||
vboot_reference = super.vboot_reference.overrideAttrs(attrs: {
|
||||
# https://github.com/NixOS/nixpkgs/pull/69039
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace "ar qc" '${self.stdenv.cc.bintools.targetPrefix}ar qc'
|
||||
'';
|
||||
});
|
||||
|
||||
# Things specific to mobile-nixos.
|
||||
# Not necessarily internals, but they probably won't go into <nixpkgs>.
|
||||
mobile-nixos = {
|
||||
|
67
systems/depthcharge/default.nix
Normal file
67
systems/depthcharge/default.nix
Normal file
@ -0,0 +1,67 @@
|
||||
{ device_config
|
||||
, fetchurl
|
||||
, runCommandNoCC
|
||||
, initrd
|
||||
|
||||
, dtc
|
||||
, ubootTools
|
||||
, vboot_reference
|
||||
, xz
|
||||
, writeTextFile
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (device_info) arch kernel kernel_cmdline dtbs;
|
||||
device_info = device_config.info;
|
||||
device_name = device_config.name;
|
||||
kernel_file = "${kernel}/${kernel.file}";
|
||||
kpart_config = writeTextFile {
|
||||
name = "kpart-config-${device_name}";
|
||||
text = kernel_cmdline;
|
||||
};
|
||||
|
||||
# https://github.com/thefloweringash/kevin-nix/issues/3
|
||||
make-kernel-its = fetchurl {
|
||||
url = "https://raw.githubusercontent.com/thefloweringash/kevin-nix/e4156870bdb0a374b92c2291e5061d2c1a6c14b3/modules/make-kernel-its.sh";
|
||||
sha256 = "05918hcmrgrj71hiq460gpzz8lngz2ccf617m9p4c82s43v4agmg";
|
||||
};
|
||||
|
||||
kpart = runCommandNoCC "depthcharge-${device_name}" {
|
||||
nativeBuildInputs = [
|
||||
dtc
|
||||
ubootTools
|
||||
vboot_reference
|
||||
xz
|
||||
];
|
||||
} ''
|
||||
# Bootloader
|
||||
dd if=/dev/zero of=bootloader.bin bs=512 count=1
|
||||
|
||||
# Kernel
|
||||
lzma --threads 0 < ${kernel_file} > kernel.lzma
|
||||
|
||||
ln -s ${dtbs} dtbs
|
||||
ln -s ${initrd} initrd
|
||||
|
||||
bash ${make-kernel-its} $PWD > kernel.its
|
||||
|
||||
mkimage \
|
||||
-D "-I dts -O dtb -p 2048" \
|
||||
-f kernel.its \
|
||||
vmlinux.uimg
|
||||
|
||||
mkdir -p $out/
|
||||
|
||||
futility vbutil_kernel \
|
||||
--version 1 \
|
||||
--bootloader bootloader.bin \
|
||||
--vmlinuz vmlinux.uimg \
|
||||
--arch ${arch} \
|
||||
--keyblock ${vboot_reference}/share/vboot/devkeys/kernel.keyblock \
|
||||
--signprivate ${vboot_reference}/share/vboot/devkeys/kernel_data_key.vbprivk \
|
||||
--config ${kpart_config} \
|
||||
--pack $out/kpart
|
||||
'';
|
||||
in
|
||||
# FIXME: produce more than the kernel partition.
|
||||
kpart
|
Loading…
Reference in New Issue
Block a user