clean up device tree package

This commit is contained in:
Florian Agbuya 2024-02-16 18:47:16 +08:00
parent 25ef8fa486
commit afa00efee3
2 changed files with 34 additions and 36 deletions

View File

@ -10,7 +10,6 @@
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };
not-os-cfg = not-os-configured.config.system; not-os-cfg = not-os-configured.config.system;
fsbl-support = ./fast-servo/fsbl-support; fsbl-support = ./fast-servo/fsbl-support;
dts-support = ./fast-servo/dts-support;
patched-not-os = pkgs.applyPatches { patched-not-os = pkgs.applyPatches {
name = "not-os-patched"; name = "not-os-patched";
@ -214,38 +213,40 @@
dontFixup = true; dontFixup = true;
}; };
u-boot = (pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot { u-boot = let
defconfig = "xilinx_zynq_virt_defconfig"; fast-servo-dts = fast-servo/fast-servo.dts;
patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch; in (pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
preConfigure = '' defconfig = "xilinx_zynq_virt_defconfig";
export DEVICE_TREE=zynq-${board} patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch;
''; preConfigure = ''
extraConfig = '' export DEVICE_TREE=zynq-${board}
CONFIG_SYS_PROMPT="${board}-boot> " '';
CONFIG_AUTOBOOT=y extraConfig = ''
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] '' CONFIG_SYS_PROMPT="${board}-boot> "
setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-cfg.build.toplevel}' CONFIG_AUTOBOOT=y
fatload mmc 0 0x6400000 uImage CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
fatload mmc 0 0x8000000 ${board}.dtb setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-cfg.build.toplevel}'
fatload mmc 0 0xA400000 uRamdisk.image.gz fatload mmc 0 0x6400000 uImage
bootm 0x6400000 0xA400000 0x8000000 fatload mmc 0 0x8000000 ${board}.dtb
''}" fatload mmc 0 0xA400000 uRamdisk.image.gz
CONFIG_BOOTDELAY=0 bootm 0x6400000 0xA400000 0x8000000
CONFIG_USE_BOOTCOMMAND=y ''}"
''; CONFIG_BOOTDELAY=0
extraMeta.platforms = [ "armv7l-linux" ]; CONFIG_USE_BOOTCOMMAND=y
filesToInstall = [ "u-boot.elf" ]; '';
}).overrideAttrs (oldAttrs: { extraMeta.platforms = [ "armv7l-linux" ];
postUnpack = '' filesToInstall = [ "u-boot.elf" ];
cp ${dts-support}/fast-servo.dts $sourceRoot/arch/arm/dts/zynq-fast-servo.dts }).overrideAttrs (oldAttrs: {
''; postUnpack = ''
postInstall = '' cp ${fast-servo-dts} $sourceRoot/arch/arm/dts/zynq-fast-servo.dts
mkdir -p $out/dts '';
cp arch/arm/dts/zynq-fast-servo.dts $out/dts postInstall = ''
cp arch/arm/dts/zynq-zc706.dts $out/dts mkdir -p $out/dts
cp arch/arm/dts/zynq-7000.dtsi $out/dts cp arch/arm/dts/zynq-fast-servo.dts $out/dts
''; cp arch/arm/dts/zynq-zc706.dts $out/dts
}); cp arch/arm/dts/zynq-7000.dtsi $out/dts
'';
});
bootimage = pkgs.runCommand "${board}-bootimage" bootimage = pkgs.runCommand "${board}-bootimage"
{ {
@ -274,8 +275,6 @@
} }
'' ''
mkdir -p $out mkdir -p $out
DTSDIR=$(mktemp -d /tmp/dts-XXXXXX)
cd $DTSDIR
cp ${u-boot}/dts/zynq-${board}.dts . cp ${u-boot}/dts/zynq-${board}.dts .
if [ ${board} == "zc706" ]; then if [ ${board} == "zc706" ]; then
@ -286,7 +285,6 @@
dtc -I dts -O dtb -o ${board}.dtb zynq-${board}.dts dtc -I dts -O dtb -o ${board}.dtb zynq-${board}.dts
cp ${board}.dtb $out cp ${board}.dtb $out
rm -rf $DTSDIR
''; '';
sd-image = let sd-image = let