1
0
Fork 0

device tree source from u-boot and cleanup

This commit is contained in:
Florian Agbuya 2024-02-14 14:53:18 +08:00
parent 388e7e7082
commit 073f1c9bbd
3 changed files with 56 additions and 56 deletions

View File

@ -1,31 +1,31 @@
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 480269fa60..df94fc1213 100644 index 480269fa60..64b20e4200 100644
--- a/arch/arm/dts/Makefile --- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile
@@ -333,6 +333,7 @@ dtb-$(CONFIG_ARCH_UNIPHIER_SLD8) += \ @@ -339,6 +339,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \
uniphier-sld8-ref.dtb zynq-cse-nor.dtb \
zynq-cse-qspi-single.dtb \
dtb-$(CONFIG_ARCH_ZYNQ) += \ zynq-dlc20-rev1.0.dtb \
+ fast-servo.dtb \ + zynq-fast-servo.dtb \
bitmain-antminer-s9.dtb \ zynq-microzed.dtb \
zynq-cc108.dtb \ zynq-minized.dtb \
zynq-cse-nand.dtb \ zynq-picozed.dtb \
diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig
index 474abc7f6b..5fc86fabfe 100644 index 474abc7f6b..6e6bbd4aab 100644
--- a/configs/xilinx_zynq_virt_defconfig --- a/configs/xilinx_zynq_virt_defconfig
+++ b/configs/xilinx_zynq_virt_defconfig +++ b/configs/xilinx_zynq_virt_defconfig
@@ -80,6 +80,7 @@ CONFIG_CMD_MTDPARTS_SPREAD=y @@ -80,6 +80,7 @@ CONFIG_CMD_MTDPARTS_SPREAD=y
CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
CONFIG_CMD_UBI=y CONFIG_CMD_UBI=y
CONFIG_OF_BOARD=y CONFIG_OF_BOARD=y
+CONFIG_SYS_CONFIG_NAME="fast-servo" +CONFIG_SYS_CONFIG_NAME="zynq-fast-servo"
CONFIG_OF_LIST="zynq-zc702 zynq-zc706 zynq-zc770-xm010 zynq-zc770-xm011 zynq-zc770-xm011-x16 zynq-zc770-xm012 zynq-zc770-xm013 zynq-cc108 zynq-microzed zynq-minized zynq-picozed zynq-zed zynq-zturn zynq-zturn-v5 zynq-zybo zynq-zybo-z7 zynq-dlc20-rev1.0" CONFIG_OF_LIST="zynq-zc702 zynq-zc706 zynq-zc770-xm010 zynq-zc770-xm011 zynq-zc770-xm011-x16 zynq-zc770-xm012 zynq-zc770-xm013 zynq-cc108 zynq-microzed zynq-minized zynq-picozed zynq-zed zynq-zturn zynq-zturn-v5 zynq-zybo zynq-zybo-z7 zynq-dlc20-rev1.0"
CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_FAT=y
diff --git a/include/configs/fast-servo.h b/include/configs/fast-servo.h diff --git a/include/configs/zynq-fast-servo.h b/include/configs/zynq-fast-servo.h
new file mode 100644 new file mode 100644
index 0000000000..0aa486a2b7 index 0000000000..0aa486a2b7
--- /dev/null --- /dev/null
+++ b/include/configs/fast-servo.h +++ b/include/configs/zynq-fast-servo.h
@@ -0,0 +1 @@ @@ -0,0 +1 @@
+#include <configs/zynq-common.h> +#include <configs/zynq-common.h>

View File

@ -204,6 +204,39 @@
dontFixup = true; dontFixup = true;
}; };
u-boot = { board ? "zc706" }: (pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
defconfig = "xilinx_zynq_virt_defconfig";
patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch;
preConfigure = ''
export DEVICE_TREE=zynq-${board}
'';
extraConfig = ''
CONFIG_SYS_PROMPT="${board}-boot> "
CONFIG_AUTOBOOT=y
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-cfg.build.toplevel}'
fatload mmc 0 0x6400000 uImage
fatload mmc 0 0x8000000 ${board}.dtb
fatload mmc 0 0xA400000 uRamdisk.image.gz
bootm 0x6400000 0xA400000 0x8000000
''}"
CONFIG_BOOTDELAY=0
CONFIG_USE_BOOTCOMMAND=y
'';
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.elf" ];
}).overrideAttrs (oldAttrs: {
postUnpack = ''
cp ${dts-support}/fast-servo.dts $sourceRoot/arch/arm/dts/zynq-fast-servo.dts
'';
postInstall = ''
mkdir -p $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 = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage" bootimage = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage"
{ {
buildInputs = [ mkbootimage ]; buildInputs = [ mkbootimage ];
@ -233,47 +266,19 @@
mkdir -p $out mkdir -p $out
DTSDIR=$(mktemp -d /tmp/dts-XXXXXX) DTSDIR=$(mktemp -d /tmp/dts-XXXXXX)
cd $DTSDIR cd $DTSDIR
cp ${not-os-cfg.build.kernel}/zynq-zc706.dts . cp ${u-boot { inherit board; }}/dts/zynq-${board}.dts .
cp ${not-os-cfg.build.kernel}/zynq-7000.dtsi .
gcc -E -nostdinc -undef -D__DTS__ -x assembler-with-cpp -o zc706.dts zynq-zc706.dts
# Fast-servo dts file already pre-processed if [ ${board} == "zc706" ]; then
cp ${dts-support}/fast-servo.dts . mv zynq-${board}.dts zynq-${board}-top.dts
cp ${u-boot { inherit board; }}/dts/zynq-7000.dtsi .
gcc -E -nostdinc -undef -D__DTS__ -x assembler-with-cpp -o zynq-${board}.dts zynq-${board}-top.dts
fi
dtc -I dts -O dtb -o ${board}.dtb ${board}.dts dtc -I dts -O dtb -o ${board}.dtb zynq-${board}.dts
chmod +x ${board}.dtb
cp ${board}.dtb $out cp ${board}.dtb $out
rm -rf $DTSDIR rm -rf $DTSDIR
''; '';
u-boot = { board ? "zc706" }: (pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
defconfig = "xilinx_zynq_virt_defconfig";
patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch;
preConfigure = ''
export DEVICE_TREE=$([ "${board}" = "zc706" ] && echo "zynq-${board}" || echo "${board}")
'';
extraConfig = ''
CONFIG_SYS_PROMPT="${board}-boot> "
CONFIG_AUTOBOOT=y
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-cfg.build.toplevel}'
fatload mmc 0 0x6400000 uImage
fatload mmc 0 0x8000000 ${board}.dtb
fatload mmc 0 0xA400000 uRamdisk.image.gz
bootm 0x6400000 0xA400000 0x8000000
''}"
CONFIG_BOOTDELAY=0
CONFIG_USE_BOOTCOMMAND=y
'';
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.elf" ];
}).overrideAttrs (oldAttrs: {
postUnpack = ''
cp ${dts-support}/fast-servo.dts $sourceRoot/arch/arm/dts/fast-servo.dts
'';
});
sd-image = { board ? "zc706" }: let sd-image = { board ? "zc706" }: let
rootfsImage = pkgs.callPackage (pkgs.path + "/nixos/lib/make-ext4-fs.nix") { rootfsImage = pkgs.callPackage (pkgs.path + "/nixos/lib/make-ext4-fs.nix") {
storePaths = [ not-os-cfg.build.toplevel ]; storePaths = [ not-os-cfg.build.toplevel ];
@ -376,15 +381,15 @@
packages.armv7l-linux = { packages.armv7l-linux = {
not-os = not-os-cfg.build.zynq_image; not-os = not-os-cfg.build.zynq_image;
zc706-fsbl = fsbl { board = "zc706"; }; zc706-fsbl = fsbl { board = "zc706"; };
zc706-u-boot = u-boot { board = "zc706"; };
zc706-bootimage = bootimage { board = "zc706"; }; zc706-bootimage = bootimage { board = "zc706"; };
zc706-dtb = dtb { board = "zc706"; }; zc706-dtb = dtb { board = "zc706"; };
zc706-u-boot = u-boot { board = "zc706"; };
zc706-sd-image = sd-image { board = "zc706"; }; zc706-sd-image = sd-image { board = "zc706"; };
zc706-qemu = not-os-qemu { board = "zc706"; }; zc706-qemu = not-os-qemu { board = "zc706"; };
fast-servo-fsbl = fsbl { board = "fast-servo"; }; fast-servo-fsbl = fsbl { board = "fast-servo"; };
fast-servo-u-boot = u-boot { board = "fast-servo"; };
fast-servo-bootimage = bootimage { board = "fast-servo"; }; fast-servo-bootimage = bootimage { board = "fast-servo"; };
fast-servo-dtb = dtb { board = "fast-servo"; }; fast-servo-dtb = dtb { board = "fast-servo"; };
fast-servo-u-boot = u-boot { board = "fast-servo"; };
fast-servo-sd-image = sd-image { board = "fast-servo"; }; fast-servo-sd-image = sd-image { board = "fast-servo"; };
fast-servo-qemu = not-os-qemu { board = "fast-servo"; }; fast-servo-qemu = not-os-qemu { board = "fast-servo"; };
}; };

View File

@ -139,7 +139,7 @@ diff --git a/zynq_image.nix b/zynq_image.nix
index 3fa23ab..727e3ef 100644 index 3fa23ab..727e3ef 100644
--- a/zynq_image.nix --- a/zynq_image.nix
+++ b/zynq_image.nix +++ b/zynq_image.nix
@@ -1,66 +1,101 @@ @@ -1,66 +1,96 @@
-{ config, pkgs, ... }: -{ config, pkgs, ... }:
+{ lib, config, pkgs, ... }: +{ lib, config, pkgs, ... }:
@ -176,11 +176,6 @@ index 3fa23ab..727e3ef 100644
- }; - };
- customKernelPackages = pkgs.linuxPackagesFor customKernel; - customKernelPackages = pkgs.linuxPackagesFor customKernel;
+ }).overrideAttrs (oa: { + }).overrideAttrs (oa: {
+ postUnpack = ''
+ mkdir -p $out
+ cp $sourceRoot/arch/arm/boot/dts/zynq-7000.dtsi $out
+ cp $sourceRoot/arch/arm/boot/dts/zynq-zc706.dts $out
+ '';
+ postInstall = '' + postInstall = ''
+ cp arch/arm/boot/uImage $out + cp arch/arm/boot/uImage $out
+ ${oa.postInstall} + ${oa.postInstall}