From 0242cec977fe11ac1f33560d067a6393f0684507 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 4 Dec 2023 23:32:43 +0000 Subject: [PATCH] run-liminix-vm: remove unneeded second copy of pad code --- pkgs/run-liminix-vm/run-liminix-vm.fnl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkgs/run-liminix-vm/run-liminix-vm.fnl b/pkgs/run-liminix-vm/run-liminix-vm.fnl index d1278fd..a891912 100644 --- a/pkgs/run-liminix-vm/run-liminix-vm.fnl +++ b/pkgs/run-liminix-vm/run-liminix-vm.fnl @@ -4,7 +4,7 @@ (local { : fdopen } (require :posix.stdio)) (fn pad-file [name kb chr] - (let [(fd out) (mkstemp "run-vm-XXXXXXX") + (let [(fd out) (mkstemp "run-vm-XXXXXX") pad-string (string.rep (or chr "\0") 1024)] (with-open [f (fdopen fd :w)] (for [i 1 kb] (f:write pad-string)) @@ -75,15 +75,7 @@ (fn bootable [cmdline uboot] (if uboot - (let [pflash (os.tmpname) - ffs (string.rep "\xff" 1024)] - (with-open [f (assert (io.open pflash :wb))] - (for [i 1 (* 4 1024)] (f:write ffs)) - (f:seek :set 0) - (with-open [uboot-bin (assert (io.open uboot :rb))] - (f:write (uboot-bin:read "*a"))) - (f:seek :end 0)) - ["-drive" (.. "if=pflash,format=raw,file=\"" pflash "\"")]) + ["-drive" (.. "if=pflash,format=raw,file=" uboot )] (let [cmdline (.. cmdline " liminix mtdparts=phram0:16M(rootfs) phram.phram=phram0," options.phram-address ",16Mi,65536 root=/dev/mtdblock0")] ["-kernel" options.kernel "-append" cmdline])))