openrisc.lists.librecores.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: linux-openrisc@vger.kernel.org
Cc: Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>
Subject: Adding or1k support to mkroot.
Date: Tue, 12 Dec 2023 04:16:15 -0600	[thread overview]
Message-ID: <79b2561e-3167-9758-8196-f2470aec06f7@landley.net> (raw)

Toybox has a tiny system builder in it, a ~300 line bash script that builds
Linux for a dozen targets (using musl-cross-make toolchains) and boots the
result to a shell prompt under QEMU:

https://github.com/landley/toybox/blob/master/mkroot/mkroot.sh
https://landley.net/bin/mkroot/latest/

And since musl and qemu both support openrisc (and I need an or1k toolchain
anyway for my orange pi 3b's power controller firmware, at least according to
u-boot's board/sunxi/README.sunxi64), I thought I'd try to make that target work.

I built an or1k musl+gcc toolchain with my wrapper script around Rich Felker's
musl-cross-make project by adding "or1k::" to the TARGETS list in
https://github.com/landley/toybox/blob/master/scripts/mcm-buildall.sh#L34 and
that seems to have worked-ish. (Well, the kernel headers didn't install because
I have to add or1k->openrisc to musl-cross-make's TARGET_ARCH_MANGLED in
litecross/Makefile, but eh, close enough for the moment.)

With the resulting toolchain, I can build an or1ksim_defconfig kernel (using
v6.6 source) that "qemu-system-or1k -nographic -kernel vmlinux" gives boot
messages for! Woo! (And then panics because no init, but that's standard for
board bringup.)

Some immediately obvious problems are:

1) qemu's -append is ignored, the "Kernel command line: earlycon" is hardwired
into the device tree.

2) Nothing I do seems to get qemu to exit instead of hanging,
CONFIG_PANIC_TIMEOUT=1 makes it _try_ to reboot but adding the CONFIG_POWER
symbols from arch/openrisc/configs/virt_defconfig doesn't seem to affect qemu,
and none of the other targets mention power. (If I can't exit the emulator at
the end then https://github.com/landley/toybox/blob/master/mkroot/testroot.sh
can't report success for the architecture.)

3) If I feed qemu-system-or1k an -initrd the same kernel does NOT give me boot
messages, it just hangs.

Well, SORT OF. If I feed -initrd 2 megabytes copied from /dev/null by dd, I get
boot messages. If I go "true | gz > blah.gz" to create the smallest (20 byte) gz
file and feed it that, no boot messages. Feed it System.map: boot messages. Feed
it vmlinux: no boot messages.

Any idea what's going on here? That last one's kind of a blocker...

Thanks,

Rob

             reply	other threads:[~2023-12-12 10:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 10:16 Rob Landley [this message]
2023-12-14 19:50 ` Adding or1k support to mkroot Stafford Horne
2023-12-15 13:33   ` Rob Landley
2023-12-16  9:44     ` Stafford Horne
2023-12-16 13:00       ` Rob Landley
2023-12-17  9:05         ` Stafford Horne
2023-12-19 11:19           ` Rob Landley
2023-12-21  8:22           ` Rob Landley

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=79b2561e-3167-9758-8196-f2470aec06f7@landley.net \
    --to=rob@landley.net \
    --cc=jonas@southpole.se \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=shorne@gmail.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).