wip
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
, pkgsCross
|
||||
, python3
|
||||
, dtc
|
||||
, imagemagick
|
||||
, isRelease ? false
|
||||
, withTools ? true
|
||||
, withChainloading ? false
|
||||
, rust-bin ? null
|
||||
, customLogo ? null
|
||||
}:
|
||||
|
||||
assert withChainloading -> rust-bin != null;
|
||||
@@ -23,14 +25,14 @@ let
|
||||
});
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "m1n1";
|
||||
version = "1.1.3";
|
||||
version = "1.1.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking branch: https://github.com/AsahiLinux/m1n1/tree/main
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/stable/m1n1/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "m1n1";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-S2HLBLmgER0ZZJ5Q4EX2f1KDxnol0yCDrloDMJaLwBE=";
|
||||
hash = "sha256-4Ykh+EzOCRtZQD1upUDJpi5ikMOCnxLwvLWajtMo7LU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
@@ -41,7 +43,8 @@ in stdenv.mkDerivation rec {
|
||||
nativeBuildInputs = [
|
||||
dtc
|
||||
pkgsCross.aarch64-multiplatform.buildPackages.gcc
|
||||
] ++ lib.optional withChainloading rustenv;
|
||||
] ++ lib.optional withChainloading rustenv
|
||||
++ lib.optional (customLogo != null) imagemagick;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace proxyclient/m1n1/asm.py \
|
||||
@@ -49,9 +52,21 @@ in stdenv.mkDerivation rec {
|
||||
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString (customLogo != null) ''
|
||||
pushd data &>/dev/null
|
||||
ln -fs ${customLogo} bootlogo_256.png
|
||||
if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
|
||||
echo "Custom logo is not a 256x256 PNG"
|
||||
exit 1
|
||||
fi
|
||||
rm bootlogo_128.png
|
||||
convert bootlogo_256.png -resize 128x128 bootlogo_128.png
|
||||
./makelogo.sh
|
||||
popd &>/dev/null
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/build
|
||||
cp build/m1n1.macho $out/build
|
||||
cp build/m1n1.bin $out/build
|
||||
@@ -59,7 +74,6 @@ in stdenv.mkDerivation rec {
|
||||
mkdir -p $out/{bin,script,toolchain-bin}
|
||||
cp -r proxyclient $out/script
|
||||
cp -r tools $out/script
|
||||
|
||||
for toolpath in $out/script/proxyclient/tools/*.py; do
|
||||
tool=$(basename $toolpath .py)
|
||||
script=$out/bin/m1n1-$tool
|
||||
@@ -69,17 +83,14 @@ ${pyenv}/bin/python $toolpath "\$@"
|
||||
EOF
|
||||
chmod +x $script
|
||||
done
|
||||
|
||||
GCC=${pkgsCross.aarch64-multiplatform.buildPackages.gcc}
|
||||
BINUTILS=${pkgsCross.aarch64-multiplatform.buildPackages.binutils}
|
||||
REAL_BINUTILS=$(grep -o '/nix/store/[^ ]*binutils[^ ]*' $BINUTILS/nix-support/propagated-user-env-packages)
|
||||
|
||||
BINUTILS=${pkgsCross.aarch64-multiplatform.buildPackages.binutils-unwrapped}
|
||||
ln -s $GCC/bin/*-gcc $out/toolchain-bin/
|
||||
ln -s $GCC/bin/*-ld $out/toolchain-bin/
|
||||
ln -s $REAL_BINUTILS/bin/*-objcopy $out/toolchain-bin/
|
||||
ln -s $REAL_BINUTILS/bin/*-objdump $out/toolchain-bin/
|
||||
ln -s $REAL_BINUTILS/bin/*-nm $out/toolchain-bin/
|
||||
ln -s $BINUTILS/bin/*-objcopy $out/toolchain-bin/
|
||||
ln -s $BINUTILS/bin/*-objdump $out/toolchain-bin/
|
||||
ln -s $GCC/bin/*-nm $out/toolchain-bin/
|
||||
'') + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user