Re: Running m68k on qemu with external initramfs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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....



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux