I'm working on a RISC-V Linux system that uses busybox and switch_root. My goal 
is to build and include a tool chain (GDB, GCC, etc) into this RISC-V Linux. I 
figured I could create a non-volatile image and attach that in QEMU, which 
works fine. What is not working is the "switch_root" portion. I know it needs 
to run at PID 1 and to use "exec". But that doesn't cut it. It runs, but 
doesn't switch root. I'll post my inittab files below.

This is the inittab on the initramfs:

::sysinit:/bin/busybox mount -t devpts devpts /dev/pts
::sysinit:/bin/busybox mount -t tmpfs tmpfs /dev/shm
::sysinit:/bin/busybox mount -t proc proc /proc
::sysinit:/bin/busybox mount -t sysfs sysfs /sys
::sysinit:/bin/busybox mount -t tmpfs tmpfs /tmp
::sysinit:/bin/busybox --install -s
::sysinit:/bin/busybox echo /sbin/mdev > /proc/sys/kernel/hotplug
::sysinit:/bin/busybox mdev -s
::sysinit:/bin/busybox mount -t xfs /dev/vda /mnt
/dev/console::sysinit:-/bin/ash

When I run switch_root it executes and just hangs with no console so I added 
the line:

::respawn:-/bin/ash

which now returns to console like I want. However, it didn't switch_root after 
I run:

exec switch_root -c /dev/console /mnt /sbini/init

I am still on the initramfs and I still have the new root on /mnt

I also noticed that switch_root runs this /etc/inittab no matter what -- even 
if I delete it -- when I run switch_root. I guess I was expected the new file 
system's inittab to take over and I could just have a few lines to run. The 
primary function would be to get back to the console with ::respawn:-/bin/ash.

What am I missing?



_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to