9front - general discussion about 9front
 help / color / mirror / Atom feed
* [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

* Re: [9front] vmx vs openbsd-current bsd.rd
  2021-09-25  3:09 [9front] vmx vs openbsd-current bsd.rd ori
@ 2021-09-25 11:20 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2021-09-25 11:20 UTC (permalink / raw)
  To: 9front

i think it is fine, given that this is the last thing we try anyway before
giving up on ELF.

--
cinap

^ 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

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ https://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git