9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: [9front] vmx vs openbsd-current bsd.rd
Date: Fri, 24 Sep 2021 23:09:30 -0400	[thread overview]
Message-ID: <3A5F5200C275EA06CC187B9502F0D1AD@eigenstate.org> (raw)

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;
 }


             reply	other threads:[~2021-09-25  3:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25  3:09 ori [this message]
2021-09-25 11:20 ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A5F5200C275EA06CC187B9502F0D1AD@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).