aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/earlyinit/hsu.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-11-08 18:55:19 +0900
committerOphestra <cat@gensokyo.uk>2026-11-08 19:17:35 +0900
commit8c15959571568b231afe1eb3358ca3da7c00b026 (patch)
treeb4d1b33e2fc06da00cc47beadad740b86113acca /cmd/earlyinit/hsu.go
parent085498b62ca37414d7c97fca9063526032c1f36e (diff)
cmd/hsu: move Rosa OS hsurc
This file is generated by the operating system. Pointing it to /system requires ugly tricks to bind mount over it. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/earlyinit/hsu.go')
-rw-r--r--cmd/earlyinit/hsu.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/cmd/earlyinit/hsu.go b/cmd/earlyinit/hsu.go
new file mode 100644
index 00000000..ea25c1a9
--- /dev/null
+++ b/cmd/earlyinit/hsu.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "os"
+ "strconv"
+)
+
+// updateHsu replaces the hsurc file.
+func updateHsu(pairs [][2]uint32) error {
+ w, err := os.OpenFile(
+ "/misc/hsurc",
+ os.O_CREATE|os.O_TRUNC|os.O_WRONLY,
+ 0400,
+ )
+ if err != nil {
+ return err
+ }
+
+ buf := make([]byte, 0, os.Getpagesize())
+ for _, pair := range pairs {
+ buf = buf[:0]
+ buf = strconv.AppendUint(buf, uint64(pair[0]), 10)
+ buf = append(buf, ' ')
+ buf = strconv.AppendUint(buf, uint64(pair[1]), 10)
+ buf = append(buf, '\n')
+ if _, err = w.Write(buf); err != nil {
+ _ = w.Close()
+ return err
+ }
+ }
+ return w.Close()
+}