* [9front] vmx vs openbsd-current bsd.rd
@ 2021-09-25 3:09 ori
2021-09-25 11:20 ` cinap_lenrek
0 siblings, 1 reply; 2+ messages in thread
From: ori @ 2021-09-25 3:09 UTC (permalink / raw)
To: 9front
It seems that some time around the OpenBSD 6.9 release,
bsd.rd ended up getting compressed, and losing most of
its symbols; now, our heuristics for image detection
fail to detect it. We used to expect an 'ostype' elf
symbol that contained OpenBSD, but that's only present
on the bsd, bsd.mp kernels:
$ nm bsdSNAP.rd ffffffff81532ba0 D rd_root_image
ffffffff81532b90 D rd_root_size
So, I hacked up the kernel detection heuristic. Still,
this feels a bit gross.
Does anyone have any better options?
diff 8f4842d3465e96d264f5c2f7fa2d61db871aae9f uncommitted
--- a/sys/src/cmd/vmx/ksetup.c
+++ b/sys/src/cmd/vmx/ksetup.c
@@ -728,7 +728,7 @@
static int
tryelf(void)
{
- char *s;
+ char *s, *t;
if(!elfheaders()) return 0;
elfdata();
@@ -735,6 +735,11 @@
if(!elfsymbols()) return 0;
s = symaddr(elfsym("ostype"));
if(s != nil && strcmp(s, "OpenBSD") == 0)
+ return obsdload();
+ /* from 6.9 up, bsd.rd has just these syms */
+ s = symaddr(elfsym("rd_root_image"));
+ t = symaddr(elfsym("rd_root_size"));
+ if(s != nil && t != nil)
return obsdload();
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-25 11:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 3:09 [9front] vmx vs openbsd-current bsd.rd ori
2021-09-25 11:20 ` cinap_lenrek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).