linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	linux-m68k@vger.kernel.org, Laurent Vivier <Laurent@Vivier.EU>
Subject: Re: Running m68k on qemu with external initramfs?
Date: Sun, 12 Apr 2020 07:48:10 -0500	[thread overview]
Message-ID: <238ea76c-fa8e-0134-667b-3864938d9a78@landley.net> (raw)
In-Reply-To: <c4a784d9-2fef-ee90-9ff3-b1d8487e8a8b@physik.fu-berlin.de>

On 4/11/20 7:12 AM, John Paul Adrian Glaubitz wrote:
> Hi Rob!

Hello.

> On 4/11/20 2:50 AM, Rob Landley wrote:
>> I'm adding m68k support to toybox's "make root" target and I have a kernel and a
>> rootfs.cpio.gz, but qemu's -initrd option doesn't put the rootfs image somewhere
>> the m68k kernel can find it.
> 
> Can you try whether this guide works for you with your version of qemu?
> 
>> https://wiki.debian.org/M68k/QemuSystemM68k

Install debian to a block device to see why initramfs isn't working?

I already downloaded and ran
http://landley.net/aboriginal/downloads/binaries/system-image-m68k.tar.gz to
make sure laurent's tip of tree qemu-m68k is working, and that booted to a shell
prompt fine, but that's using a static initramfs instead of an external once,
which is why I thought that was the issue. (It used to be back when I first made
that work, which was something like 2014.)

I also ran my toybox binary under qemu-m68k to smoketest that the compiler was
making binaries that ran, but it turns out that I had two problems:

1) I'd run "make defconfig in the wrong directory and toybox switched the shell
back off (because it's still in "pending" until I finish it), hence the not
finding init. I stuck enough printk(KERN_ERR) into init/initramfs.c to list all
the filenames it was extracting and figured that one out.

2) THEN the problem was that gcc is doing something in cd_main so that the
"chdir ." at the start of the shell setup (to set $PWD and friends) is
segfaulting, but it's a segfault that went away when I got near it with printf()
calls, and even write(1, "", 0); right before it made it go away. Given that
this code has run on 32 and 64 bit, big and little endian, glibc musl and
bionic, and on a target that's both nommu and cares about alignment?

Someday I might build gdb for m68k, but until then I should check it next time I
upgrade compiler versions. (Or go through disabling every optimization one by
one until I find the one that's making the registers go nuts the way sh4 had
that https://landley.net/notes-2020.html#29-01-2020 thing.)

Rob

P.S: For context, I built a musl-cross-make toolchain and symlinked it into
toybox, and then used "make root CROSS=m68k LINUX=~/linux" to build a system:

git clone https://github.com/landley/musl-cross-make
git clone https://github.com/landley/toybox
cd musl-cross-make
sed -Ei 's/(BINUTILS_VER =).*/\1 2.32/;s/(LINUX_VER =).*/\1 4.19.90/' Makefile
../toybox/scripts/mcm-buildall.sh i686:: m68k::
cd ../toybox
ln -s ccc ../musl-cross-make/ccc
make root CROSS=i686 LINUX=~/linux
make root CROSS=m68k LINUX=~/linux

If you (cd root/i686; ./qemu-*.sh) it boots to a shell prompt.... well, if you
KARGS=rdinit=/bin/sh it does, running the init script still says:

ln: cannot create symbolic link from '/proc/self/fdi/,*/}' to 'dev/i/*,/}': No y
ln: cannot create symbolic link from '/proc/self/fdi/,*/}' to 'dev/i/*,/}': No y
ln: cannot create symbolic link from '/proc/self/fdi/,*/}' to 'dev/i/*,/}': No y
ln: cannot create symbolic link from '/proc/self/fdi/,*/}' to 'dev/i/*,/}': No y
sh: exec /etc/rc/*: No such file or directory
Type exit when done.
oneit: /dev/CONSOLE:-console}: No such file or directory

Because I'm still halfway through teaching toysh about all the ${} constructs.
(Also, remind me to stick echo -e '\e[?7h' at the start of my init script to
undo the STUPID wordwrap disable escape that qemu's bios outputs, which screws
up bash's command line history too!)

Anyway, at least it's known behavior. But in root/m68k I'm getting:

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
CPU: 0 PID: 1 Comm: init Not tainted 5.6.0 #1
Stack from 0f81bdfc:

But I just went over that in the previous email I sent (downside of having two
reply windows open at once), and am clicking "send" on this now because the
sun's coming up and I should have been in bed a while ago. Sorry if it's
duplicative.

P.P.S. Zzzzzzz....

  reply	other threads:[~2020-04-12 12:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-11  0:50 Running m68k on qemu with external initramfs? Rob Landley
2020-04-11  6:12 ` Finn Thain
2020-04-12  3:36   ` Rob Landley
2020-04-12  5:29     ` Finn Thain
2020-04-12 12:34       ` Rob Landley
2020-04-12  8:27     ` John Paul Adrian Glaubitz
2020-04-12  8:31       ` Laurent Vivier
2020-04-12 21:48         ` Rob Landley
2020-04-12 23:17           ` Finn Thain
2020-04-11 12:12 ` John Paul Adrian Glaubitz
2020-04-12 12:48   ` Rob Landley [this message]
2020-04-12 13:02     ` John Paul Adrian Glaubitz
2020-04-12 21:56       ` Rob Landley
2020-04-12 23:30     ` GCC?, was " Finn Thain
2020-04-13  0:28       ` Rob Landley
2020-04-13  5:17         ` Finn Thain
2020-04-13  7:07           ` Rob Landley
2020-04-13  7:41             ` John Paul Adrian Glaubitz
2020-04-13  8:27             ` Rob Landley
2020-04-13  9:42               ` Geert Uytterhoeven
2020-04-13 23:02                 ` Finn Thain

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=238ea76c-fa8e-0134-667b-3864938d9a78@landley.net \
    --to=rob@landley.net \
    --cc=Laurent@Vivier.EU \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-m68k@vger.kernel.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).