Re: Custom boot loader stub
Valery Ushakov <[email protected]> Fri, 17 Oct 2025 12:32:36 +0300
| Newsgroups | gmane.os.netbsd.ports.sparc64 |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Oct 17, 2025 at 08:03:31 +0100, Sad Clouds wrote: > Date: Fri, 17 Oct 2025 08:03:31 +0100 > From: Sad Clouds <[email protected]> > Subject: Re: Custom boot loader stub > To: Valery Ushakov <[email protected]> > Cc: [email protected] > > On Fri, 17 Oct 2025 00:11:20 +0300 > Valery Ushakov <[email protected]> wrote: > > > [off-list] Heh, I started that mail with more ramblings that I didn't want to spam everyone with, and then forgot to g/c this notice when I ended up rewriting the mail and looking up the references. Sorry :). > > On Thu, Oct 16, 2025 at 14:32:15 +0100, Sad Clouds wrote: > > > > > I think OpenBoot can execute both, Forth byte codes and SPARC binaries. > > > So I'm trying to understand how to execute SPARC binaries and in what > > > format they should be. > > > > Well, go to the source of truth :) > > > > https://github.com/openbios/openboot > > > > From a quick glance at its obp/arch/sun4u/go.fth > > > > https://github.com/openbios/openboot/blob/1a08f436/obp/arch/sun4u/go.fth#L111 > > > > I guess it will try in order elf32, elf64, and a.out > > > > The check for h# 107 is the a.out's OMAGIC (0407). > > Brilliant, thanks for that. I didn't realise OpenBoot was open sourced > on github. Also what is interesting in go.fth on line 75 the pointer to > client interface is passed in %o4 register, I think. [...] > I can now execute a very minimal bootloader on Sun T5220 with ELF64 > binary. The next step is to figure out how to call IEEE-1275 client > interface functions so I can print messages on the screen. Yes, as I said, see how sparc boot code does that: "romp", common/prompdev.c, and ofwboot/promlib.c - its ofw subclass. Start here: https://github.com/NetBSD/src/blob/d37c7118/sys/arch/sparc/stand/common/srt0.S#L152 See 5.2.1 in that 1275.1/D14a that you've mentioned at the start of the thread. -uwe