moby: upgrade Tow-Boot -> u-boot

i'm trying to get the compass to work, but looks as though it didnt try to probe the 1.2b AF8133J
This commit is contained in:
2024-07-01 16:56:46 +00:00
parent 5176d6a3bc
commit 5b7f15b278
4 changed files with 109 additions and 1 deletions

View File

@@ -277,8 +277,11 @@ in
sane.image.extraGPTPadding = 16 * 1024 * 1024;
sane.image.firstPartGap = 0;
sane.image.installBootloader = ''
dd if=${pkgs.tow-boot-pinephone}/Tow-Boot.noenv.bin of=$out bs=1024 seek=8 conv=notrunc
dd if=${pkgs.u-boot-pinephone}/u-boot-sunxi-with-spl.bin of=$out bs=1024 seek=8 conv=notrunc
'';
# sane.image.installBootloader = ''
# dd if=${pkgs.tow-boot-pinephone}/Tow-Boot.noenv.bin of=$out bs=1024 seek=8 conv=notrunc
# '';
sane.programs.gps-share.config = {
device = "/dev/ttyUSB1";

View File

@@ -0,0 +1,66 @@
# based on package from Tow-Boot
{
buildPackages,
fetchFromGitHub,
flex,
lib,
pkgsCross,
stdenv,
yacc,
}:
let
or1k-toolchain = buildPackages.pkgsCross.or1k.buildPackages;
in
stdenv.mkDerivation (finalAttrs: {
pname = "crust-firmware";
version = "0.6";
src = fetchFromGitHub {
owner = "crust-firmware";
repo = "crust";
rev = "v${finalAttrs.version}";
hash = "sha256-zalBVP9rI81XshcurxmvoCwkdlX3gMw5xuTVLOIymK5=";
};
depsBuildBuild = [
stdenv.cc
];
nativeBuildInputs = [
flex
yacc
] ++ (with or1k-toolchain; [
binutils
gcc
]);
# postPatch = ''
# substituteInPlace Makefile --replace "= lex" '= ${buildPackages.flex}/bin/flex'
# '';
env.CROSS_COMPILE = "or1k-elf-";
env.HOST_COMPILE = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}";
env.HOSTCC = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}gcc";
env.HOSTLD = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}ld";
buildPhase = ''
# make pinephone_defconfig HOST_COMPILE=$HOST_COMPILE HOSTCC=''${HOST_COMPILE}gcc
# export HOSTCC=''${HOST_COMPILE}gcc
make pinephone_defconfig HOSTCC=$HOSTCC
# make pinephone_defconfig
make scp
'';
installPhase = ''
mkdir $out
cp -v build/scp/scp.bin $out
'';
meta = with lib; {
description = "Libre SCP firmware for Allwinner sunxi SoCs";
homepage = "https://github.com/crust-firmware/crust";
license = with licenses; [ bsd3 gpl2Only mit ];
maintainers = with maintainers; [ colinsane noneucat ];
platforms = platforms.all;
};
})

View File

@@ -0,0 +1,37 @@
{
armTrustedFirmwareAllwinner,
buildUBoot,
crust-firmware-pinephone,
fetchpatch,
lib,
}:
buildUBoot {
defconfig = "pinephone_defconfig";
patches = [
(fetchpatch {
# see: <https://gitlab.com/postmarketOS/pmaports/-/issues/1945>
# Pinephone has multiple hardware revs, notably 1.2 and 1.2b.
# stock u-boot can't differentiate these, and so tries to boot a 1.2b phone
# using the 1.2 device tree, which leads (notably) to a non-functional compass (magnetometer).
url = "https://github.com/Tow-Boot/U-Boot/pull/2.diff";
hash = "sha256-o0p+M+cLgJ+pcmAHCFEzIZuFKl0ytZRkM4Qy7Hau4io=";
name = "sunxi: pinephone: detect existed magnetometer and fixup dtb";
})
];
filesToInstall = [
"u-boot" #< ELF file
"u-boot.bin" #< raw binary, load it into RAM and jump to it
"u-boot-sunxi-with-spl.bin" #< this is what Tow-Boot releases appear to be
"u-boot.cfg" #< copy of Kconfig which this u-boot was compiled with
"u-boot.dtb"
"u-boot.map"
"u-boot-nodtb.bin"
"u-boot.sym"
];
env.BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
env.SCP = "${crust-firmware-pinephone}/scp.bin";
}

View File

@@ -23,6 +23,7 @@ let
chatty-latest = callPackage ./additional/chatty-latest { };
codemadness-frontends = callPackage ./additional/codemadness-frontends { };
codemadness-frontends_0_6 = codemadness-frontends.v0_6;
crust-firmware-pinephone = callPackage ./additional/crust-firmware-pinephone { };
depthcharge-tools = callPackage ./additional/depthcharge-tools { };
eg25-control = callPackage ./additional/eg25-control { };
eg25-manager = callPackage ./additional/eg25-manager { };
@@ -108,6 +109,7 @@ let
tow-boot-pinephone = callPackage ./additional/tow-boot-pinephone { };
tree-sitter-nix-shell = callPackage ./additional/tree-sitter-nix-shell { };
trivial-builders = lib.recurseIntoAttrs (callPackage ./additional/trivial-builders { });
u-boot-pinephone = callPackage ./additional/u-boot-pinephone { };
uassets = callPackage ./additional/uassets { };
uninsane-dot-org = callPackage ./additional/uninsane-dot-org { };
wvkbd-mk = callPackage ./additional/wvkbd-mk { };