plumb rk818-charger module into the moby config
This commit is contained in:
@@ -114,9 +114,13 @@ in
|
||||
# })
|
||||
# config.boot.initrd.extraFiles
|
||||
# );
|
||||
|
||||
# });
|
||||
|
||||
boot.extraModulePackages = [
|
||||
# pkgs.rk818-charger #< rk818 battery/charger isn't mainline as of 2024-10-01
|
||||
config.boot.kernelPackages.rk818-charger #< rk818 battery/charger isn't mainline as of 2024-10-01
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
# see <repo:postmarketOS/pmaports:device/community/device-pine64-pinephonepro/modules-initfs>
|
||||
# - pmos includes: gpu_sched dw_wdt fusb302 panel_himax_hx8394 goodix_ts
|
||||
|
@@ -377,14 +377,17 @@ linux_latest.override {
|
||||
# }
|
||||
{
|
||||
# i'd like to patch some drivers, and that's easier to do when i build them for out-of-tree.
|
||||
# i can't even set these to `=m`, because then nixpkgs `system.modulesTree` will complain
|
||||
# about conflicting kernel modules (in tree + out-of-tree).
|
||||
# so just don't build these here, and rely wholly on my out-of-tree modules.
|
||||
name = "make-module-for-out-of-tree";
|
||||
patch = null;
|
||||
extraStructuredConfig = with lib.kernel; {
|
||||
# MFD_CORE = module;
|
||||
# MFD_ALTERA_SYSMGR = module;
|
||||
MFD_RK8XX = module;
|
||||
MFD_RK8XX_I2C = module;
|
||||
MFD_RK8XX_SPI = module; #< necessary for MFD_RK8XX=m to apply
|
||||
MFD_RK8XX = no;
|
||||
MFD_RK8XX_I2C = no;
|
||||
MFD_RK8XX_SPI = no; #< necessary for MFD_RK8XX=... to apply
|
||||
};
|
||||
}
|
||||
];
|
||||
|
@@ -3,7 +3,7 @@ obj-m := rk8xx-core.o rk8xx-i2c.o rk818_battery.o rk818_charger.o
|
||||
all:
|
||||
$(MAKE) -C "$(KERNEL_DIR)" M="$(PWD)" modules
|
||||
install:
|
||||
install -D rk8xx-core.ko $(INSTALL_MOD_PATH)/mfd/rk8xx-core.ko
|
||||
install -D rk8xx-i2c.ko $(INSTALL_MOD_PATH)/mfd/rk8xx-i2c.ko
|
||||
install -D rk818_battery.ko $(INSTALL_MOD_PATH)/mfd/rk818_battery.ko
|
||||
install -D rk818_charger.ko $(INSTALL_MOD_PATH)/mfd/rk818_charger.ko
|
||||
install -Dm444 rk8xx-core.ko $(INSTALL_MOD_PATH)/drivers/mfd/rk8xx-core.ko
|
||||
install -Dm444 rk8xx-i2c.ko $(INSTALL_MOD_PATH)/drivers/mfd/rk8xx-i2c.ko
|
||||
install -Dm444 rk818_battery.ko $(INSTALL_MOD_PATH)/drivers/power/supply/rk818_battery.ko
|
||||
install -Dm444 rk818_charger.ko $(INSTALL_MOD_PATH)/drivers/power/supply/rk818_charger.ko
|
||||
|
@@ -7,8 +7,15 @@
|
||||
# the former includes "rk817-charger", but nothing for the rk818.
|
||||
# the latter includes the PMIC, without mention of any battery/charger.
|
||||
# hmm...
|
||||
#
|
||||
# this package is part of the `linuxKernel.packagesFor ...` scope(s).
|
||||
# build it e.g.:
|
||||
# - `nix-build -A linuxPackages_6_11.rk818-charger`
|
||||
# - `nix-build -A hosts.moby.config.boot.kernelPackages.rk818-charger`
|
||||
{
|
||||
kernel ? linuxPackages_6_11.kernel, linuxPackages_6_11,
|
||||
buildPackages,
|
||||
kernel,
|
||||
lib,
|
||||
stdenv,
|
||||
}:
|
||||
|
||||
@@ -22,11 +29,24 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
makeFlags = [
|
||||
"KERNELRELEASE=${kernel.modDirVersion}"
|
||||
# "KERNELRELEASE=${kernel.modDirVersion}"
|
||||
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
"INSTALL_MOD_PATH=$(out)"
|
||||
"INSTALL_MOD_PATH=$(out)/lib/modules/${kernel.modDirVersion}/kernel"
|
||||
# from <repo:nixos/nixpkgs:pkgs/os-specific/linux/kernel/manual-config.nix>
|
||||
"O=$(buildRoot)"
|
||||
"CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
|
||||
"HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
|
||||
"HOSTLD=${buildPackages.stdenv.cc.bintools}/bin/${buildPackages.stdenv.cc.targetPrefix}ld"
|
||||
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||
];
|
||||
|
||||
# the modules shipped in-tree are .xz, so if i want to replace those i need to also xz this module:
|
||||
postInstall = ''
|
||||
find $out -name '*.ko' -exec xz {} \;
|
||||
'';
|
||||
|
||||
# AFAICT the module names are really just the .o files.
|
||||
# i guess if you wanted a module with more than one file,
|
||||
# you would compile all their .c sources into one .o and add just that to `obj-m`?
|
||||
|
@@ -14,6 +14,15 @@ let
|
||||
sane-data = import ../modules/data { inherit lib sane-lib; };
|
||||
sane-lib = import ../modules/lib final';
|
||||
|
||||
### ADDITIONAL KERNEL PACKAGES
|
||||
linuxKernel = unpatched.linuxKernel // {
|
||||
packagesFor = kernel: (unpatched.linuxKernel.packagesFor kernel).extend (kFinal: kPrev: {
|
||||
# build like `nix-build -A linuxPackages.rk818-charger`
|
||||
# or `nix-build -A hosts.moby.config.boot.kernelPackages.rk818-charger`
|
||||
rk818-charger = kFinal.callPackage ./additional/rk818-charger { };
|
||||
});
|
||||
};
|
||||
|
||||
### ADDITIONAL PACKAGES
|
||||
alsa-ucm-pinephone-manjaro = callPackage ./additional/alsa-ucm-pinephone-manjaro { };
|
||||
alsa-ucm-pinephone-pmos = callPackage ./additional/alsa-ucm-pinephone-pmos { };
|
||||
@@ -93,7 +102,6 @@ let
|
||||
pyln-client = callPackage ./additional/pyln-client { };
|
||||
pyln-proto = callPackage ./additional/pyln-proto { };
|
||||
qmkPackages = recurseIntoAttrs (callPackage ./additional/qmk-packages { });
|
||||
rk818-charger = callPackage ./additional/rk818-charger { };
|
||||
rtl8723cs-firmware = callPackage ./additional/rtl8723cs-firmware { };
|
||||
rtl8723cs-wowlan = callPackage ./additional/rtl8723cs-wowlan { };
|
||||
sane-backgrounds = callPackage ./additional/sane-backgrounds { };
|
||||
|
Reference in New Issue
Block a user