1

I had compile a linux kernel and generating root file system using buildroot for 64-bit powerpc. Target CPU POWER7.

Output of buildroot:

1] rootfs.cpio 2] rootfs.ext2 3] rootfs.tar.gz 4] vmlinux

Start qemu simulation with

qemu-system-ppc64 -m 1024 -kernel output/images/vmlinux -initrd output/images/rootfs.cpio -serial stdio

--> Output: Output Of 1st command

qemu-system-ppc64 -M pseries -cpu POWER7 -m 1024 -kernel output/images/vmlinux -append 'console=hvc0 root=/dev/sda' -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio

--> Output: Output of 2nd command

What have I done wrong and what can I do to fix it?

Community
  • 1
  • 1
  • Welcome to Stack Overflow! Here we tend to have all information related to the problem **in the question post** itself (as text), not linked. As you use QEMU for run your kernel, it shouldn't be difficult to prepare a text file with output and insert its content into the question post. Do that via [edit]ing the question. – Tsyvarev Dec 29 '17 at 22:58

2 Answers2

0

How long did you wait for it? I assume a while. In which case it looks like the kernel has crashed somewhere very early in boot, before it could detect the console. That can happen if you have far too little memory, but 1G should be enough. It can also happen if you build the kernel for the wrong machine/CPU type, but you seem to have gotten that right.

There's some instructions here that you could try and are known to work.

mpe
  • 2,640
  • 1
  • 19
  • 17
  • Thank you for your attention. Problem solved Using an in-tree defconfig file for pseries which is **pseries_defconfig** instead of using the architecture default configuration. – Shail Thacker Jan 22 '18 at 04:42
0

Buildroot

https://buildroot.org/

I haven't tested it for powerpc specifically, but I bet it will all just work out of the box just like it worked for every arch I've tried so far (x86, ARM and MIPS) :-)

Just follow the steps explained at: How to download the Torvalds Linux Kernel master, (re)compile it, and boot it with QEMU? and replace arm with ppc.

Then to use your own Linux kernel source, you basically just have to use LINUX_OVERRIDE_SRCDIR as explained at: How to modify the source of Buildroot packages for package development?

Edit: I knew it was just a formality, but I actually tested the commands below after writing this question and the boot worked out of the box as expected:

unset LD_LIBRARY_PATH
make qemu_ppc64_pseries_defconfig
printf '
BR2_CCACHE=y
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=n
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
BR2_PACKAGE_HOST_QEMU_VDE2=y
' >>.config
make olddefconfig
time make BR2_JLEVEL="$(nproc)" HOST_QEMU_OPTS='--enable-sdl --with-sdlabi=2.0'
./output/host/usr/bin/qemu-system-ppc64 -M pseries -cpu POWER7 -m 256 -kernel output/images/vmlinux -append 'console=hvc0 root=/dev/sda' -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985