From 742ce37cecd4c739c9cba8ab9619a491744dbf32 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 30 Aug 2024 13:46:00 +0200 Subject: [PATCH] Automatically load U-Boot environment on boot --- lagarto-ox.nix | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lagarto-ox.nix b/lagarto-ox.nix index e367f8d..39b87be 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -230,6 +230,11 @@ cat .config echo --------------------------- ''; + postBuild = '' + echo --------------------------- generated env starts + cat include/generated/env.in + echo --------------------------- generated env ends + ''; # # CONFIG_SERIAL_PRESENT=n # CONFIG_SYS_NS16550=n @@ -280,17 +285,14 @@ initrd = "${config.system.build.initialRamdisk}/initrd"; rev = if self ? rev then self.rev else throw ("Refusing to build from a dirty Git tree!"); - in prev.runCommand "uboot.txt" {} '' - cat > $out < + #fdt mknode / pmem@0x140000000 + #fdt set /pmem@0x140000000 compatible "pmem-region" + #fdt set /pmem@0x140000000 reg <0x1 0x40000000 0x0 0xc0000000> # Reduce memory to 3 GiB [0x80000000, 0x140000000) - fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000> + #fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000> # Set kernel bootcmd options. # rdinit=/preinit boot custom preinit script @@ -307,14 +309,14 @@ # tp_printk write ftrace events to console # trace_buf_size=1M set ftrace buffer to 1M # - setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0 systemd.log_level=debug systemd.log_target=console rdinit=/preinit init=${init}" - + in prev.runCommand "uboot.txt" {} '' + cat > $out <> $out - echo "setenv ramdisk_size $(stat --format %s $(readlink -f ${initrd}))" >> $out - echo 'booti ''${kernel_addr_r} ''${ramdisk_addr_r}:''${ramdisk_size} ''${fdtcontroladdr}' >> $out ''; opensbi = prev.opensbi.overrideAttrs (old: rec { @@ -342,7 +344,7 @@ "FW_PAYLOAD_FDT_ADDR=0xc0000000" ]; patches = [ - ./opensbi-timer-debug.patch + ./opensbi-timer-debug.patch # Print calls to machine trap #./opensbi-enable-meip.patch #./opensbi-enable-seip.patch #./opensbi-test-plic.patch # Working delegation test, disabled for now