Hello,
Anyone knows how to build uImage
instead of zImage
here?
I don’t know how can I use this option:
Here’s the sample of my module:
let
# dont use overlays for the qemu, it causes a lot of wasted time on recompiles
x86pkgs = import pkgs.path { system = "x86_64-linux"; };
build = config.system.build;
# armv7l cross-compile and boot fixes
customKernel = pkgs.linux.override {
extraConfig = ''
OVERLAY_FS y
'';
};
customKernelPackages = pkgs.linuxPackagesFor customKernel;
in {
boot.kernelPackages = customKernelPackages;
nixpkgs.system = "armv7l-linux";
system.build.zynq_image = let
cmdline = "root=/dev/mmcblk0 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext build.toplevel}";
qemuScript = ''
#!/bin/bash -v
export PATH=${x86pkgs.qemu}/bin:$PATH
set -x
base=$(dirname $0)
mkdir ./tmp/
cp $base/root.squashfs ./tmp/
chmod +w ./tmp/root.squashfs
truncate -s 64M ./tmp/root.squashfs
qemu-system-arm \
-M xilinx-zynq-a9 \
-serial /dev/null \
-serial stdio \
-display none \
-dtb $base/zynq-zc706.dtb \
-kernel $base/zImage \
-initrd $base/initrd \
-drive file=./tmp/root.squashfs,if=sd,format=raw \
-append "${cmdline}"
'';
in pkgs.runCommand "zynq_image" {
inherit qemuScript;
passAsFile = [ "qemuScript" ];
preferLocalBuild = true;
} ''
mkdir $out
cd $out
cp ${build.squashfs} root.squashfs
cp ${build.kernel}/*zImage .
cp ${build.initialRamdisk}/initrd initrd
cp ${build.kernel}/dtbs/zynq-zc706.dtb .
ln -sv ${build.toplevel} toplevel
cp $qemuScriptPath qemu-script
chmod +x qemu-script
patchShebangs qemu-script
ls -ltrh
'';