All of lore.kernel.org
 help / color / mirror / Atom feed
* Bootable sh4 qemu images.
@ 2016-01-08 18:12 Rob Landley
  2016-01-11 18:02 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rob Landley @ 2016-01-08 18:12 UTC (permalink / raw)
  To: linux-sh

The question was recently raised about QEMU images for sh. Since I
maintain those as part of my Aboriginal Linux project, and put out a new
release last night, I thought I'd link to and explain them.

The project page is http://landley.net/aboriginal/about.html

The sh4 images are "qemu-system-sh4.tar.gz", the current release (1.4.4)
is based on musl-libc and kernel 4.2, and the previous release (1.4.3)
was uClibc and 4.1. The stable link to historical prebuilt binary
versions is at:

  http://landley.net/aboriginal/downloads/old/binaries/

Download a system image, extract it, and run either ./run-emulator.sh
(simple initramfs-only, without compiler) or ./dev-environment.sh (with
compiler loaded from /dev/sda squashfs image).

Unfortunately qemu's r2d board can't give me multiple block devices yet
(-hdb and later are ignored) so the 2 gig ext2 image dev-environment.sh
tries to mount on /home is inaccessible, and the native-build.sh script
is useless on this target because there's no /dev/[sh]dc. Also this
board is hardwired to provide 64 megs of ram (gcc requires 256 megs to
build linux from scratch), and when you exit and the kernel tries to
halt the emulator, qemu panics and doesn't reset the TTY properly. (Type
"reset" and hit enter to get your cursor back.)

In the current release's system image tarball is a "mini.config" file
used to build the kernel. You can expand that via:

  make ARCH=sh allnoconfig KCONFIG_ALLCONFIG=mini.config

And then you have a big config from which you can build a kernel. There
are cross-compilers in each release directory, download and extract
cross-compiler-sh4.tar.gz and add its "bin" subdirectory to your path,
and use sh4- as the prefix. (Or you can use the full path to the
compiler ending with the prefix as the prefix, and not fiddle with the
$PATH.)

  make ARCH=sh CROSS_COMPILE=sh4-

(There are also sh2eb images and compilers, sh2 big endian, but the
kernels in those boot on a Numato board, not under qemu. See
http://nommu.org/jcore for details of that. Those are all still uClibc,
they should move to musl next release.)

Again, http://landley.net/aboriginal/about.html should explain or
provide links to everything else.

This is what I've been using to regression test the sh4 kernel for the
past several years. I only got involved in the sh2 nommu stuff at the
end of 2014, and dragged Rich into it what, 6 months ago?

Rob

P.S. Sorry I've fallen a couple kernel versions behind, I'm trying to
catch up but with https://lwn.net/Articles/629362/ and
https://lwn.net/Articles/616315/ and now
http://review.cyanogenmod.org/#/c/119819/1 toybox is dominating my todo
list...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bootable sh4 qemu images.
  2016-01-08 18:12 Bootable sh4 qemu images Rob Landley
@ 2016-01-11 18:02 ` Peter Zijlstra
  2016-01-11 20:42 ` Rob Landley
  2016-01-12  7:19 ` Rob Landley
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2016-01-11 18:02 UTC (permalink / raw)
  To: linux-sh

On Fri, Jan 08, 2016 at 12:12:56PM -0600, Rob Landley wrote:
> The sh4 images are "qemu-system-sh4.tar.gz", the current release (1.4.4)
> is based on musl-libc and kernel 4.2

> P.S. Sorry I've fallen a couple kernel versions behind, I'm trying to
> catch up

Ah, so you've not yet found if I broken SH in 4.3 with:

b31fdac2a921 ("sched, sh: Fold finish_arch_switch() into switch_to()")

:-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bootable sh4 qemu images.
  2016-01-08 18:12 Bootable sh4 qemu images Rob Landley
  2016-01-11 18:02 ` Peter Zijlstra
@ 2016-01-11 20:42 ` Rob Landley
  2016-01-12  7:19 ` Rob Landley
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Landley @ 2016-01-11 20:42 UTC (permalink / raw)
  To: linux-sh

On 01/11/2016 12:02 PM, Peter Zijlstra wrote:
> On Fri, Jan 08, 2016 at 12:12:56PM -0600, Rob Landley wrote:
>> The sh4 images are "qemu-system-sh4.tar.gz", the current release (1.4.4)
>> is based on musl-libc and kernel 4.2
> 
>> P.S. Sorry I've fallen a couple kernel versions behind, I'm trying to
>> catch up
> 
> Ah, so you've not yet found if I broken SH in 4.3 with:
> 
> b31fdac2a921 ("sched, sh: Fold finish_arch_switch() into switch_to()")
> 
> :-)

It's working fine with 4.3, native compiling static binaries under musl
and everything:

(sh4:3) / $ gcc /usr/src/thread-hello2.c -lpthread --static
(sh4:3) / $ ./a.out
Hello world!
(sh4:3) / $ cat /proc/version
Linux version 4.3.0 (landley@halfbrick) (gcc version 4.2.1) #1 Mon Jan
11 13:24:23 CST 2016
(sh4:3) / $ cat /proc/cpuinfo
machine		: RTS7751R2D
processor	: 0
cpu family	: sh4
cpu type	: SH7751R
cut		: unknown
cpu flags	: fpu ptea
cache type	: split (harvard)
icache size	:  4KiB (2-way)
dcache size	:  4KiB (2-way)
address sizes	: 29 bits physical
bogomips	: 120.00
(sh4:3) / $

(Dynamic linked binaries are segfaulting but that's something I did
wrong when switching to musl. My toolchain is the last gplv2 releases of
everything, patched until they work. Something needs a patch, apparently.)

I might cut a release with _just_ the new kernel version to catch up...

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bootable sh4 qemu images.
  2016-01-08 18:12 Bootable sh4 qemu images Rob Landley
  2016-01-11 18:02 ` Peter Zijlstra
  2016-01-11 20:42 ` Rob Landley
@ 2016-01-12  7:19 ` Rob Landley
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Landley @ 2016-01-12  7:19 UTC (permalink / raw)
  To: linux-sh

On 01/11/2016 02:42 PM, Rob Landley wrote:
> On 01/11/2016 12:02 PM, Peter Zijlstra wrote:
>> Ah, so you've not yet found if I broken SH in 4.3 with:
>>
>> b31fdac2a921 ("sched, sh: Fold finish_arch_switch() into switch_to()")
>>
>> :-)
> 
> It's working fine with 4.3, native compiling static binaries under musl
> and everything:
...
> I might cut a release with _just_ the new kernel version to catch up...

And I did so, same as last time except newer kernel:

  http://landley.net/aboriginal/bin/system-image-sh4.tar.gz
  http://landley.net/aboriginal/bin/cross-comiler-sh4.tar.gz

Tested with qemu-system-sh4 2.5.0, ./dev-environment.sh booted to shell
prompt and built "hello world". (Static linked, anyway. Dynamic still
has a musl hiccup somewhere.)

Of course now 4.4 is out so I'm still a release behind, but mini.config
is there as is the cross compiler, so easy enough to make your own linux
replacement image (it's just vmlinux renamed, qemu has an elf loader,
the initramfs is external to make swapping it out easier, that's why
run-emulator.sh is feeding -initrd rootfs.cpio.gz to qemu instead of
having it linked in at build time).

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-12  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 18:12 Bootable sh4 qemu images Rob Landley
2016-01-11 18:02 ` Peter Zijlstra
2016-01-11 20:42 ` Rob Landley
2016-01-12  7:19 ` Rob Landley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.