Re: qemu-system-sh4eb build has something hinky in the ethernet

Aurelien Jarno <[email protected]> Wed, 31 Dec 2025 13:15:00 +0100
Newsgroups gmane.linux.debian.ports.superh,gmane.comp.emulators.qemu
Message-ID <[email protected]>
Hi,

This discussion is specific to the SuperH port, therefore please avoid=20
mailing [email protected], which targets all ports. I have=20
already adjusted the address in Cc: to [email protected].

Thanks
Aurelien

On 2025-12-31 02:04, Rob Landley wrote:
> On 11/24/25 01:18, Philippe Mathieu-Daud=C3=A9 wrote:
> > On 1/9/25 09:47, Geert Uytterhoeven wrote:
> >=20
> > > On Sun, 24 Aug 2025 at 20:40, Rob Landley <[email protected]> wrote:
> > > > Anyway, this works fine on little endian, but the qemu-system-sh4eb
> > > > build has something hinky in the ethernet, I haven't tackled it mys=
elf
> > > > because I don't know whether the device emulation or the driver is
> > > > what's missing an endian swap. (I don't want to fix it the "wrong w=
ay",
> > >=20
> > > That is using sh_eth, right?
> > >=20
> > > Last time I tried booting a big-endian ARM kernel on R-Car M2-W,
> > > the Linux kernel booted fine, except for Ethernet.=C2=A0 So sh_eth is
> > > definitely
> > > not big-endian clean.
> >=20
> > qemu-system-sh4{eb} only emulates the R2D+ board, which AFAIK
> > provides ethernet via a RTL8139 over PCI. While old, RTL8139
> > is very tested and expected to have endianness well handled.
>=20
> Expected, sure. In reality? Compare the sh4 vs sh4eb tarballs in
> https://landley.net/bin/mkroot/0.8.13/ (in each case extract and
> ./run-qemu.sh should get you a shell prompt).
>=20
> The sh4 one has working ethernet, the sh4eb one always reports link down =
and
> it doesn't seem to probe the mac address right. Built from almost the same
> configs, the only difference is:
>=20
> https://github.com/landley/toybox/blob/0.8.13/mkroot/mkroot.sh#L297
>=20
> Line 305 adds:
>     [ "$CROSS" =3D=3D sh4eb ] && KCONF+=3D,CPU_BIG_ENDIAN
>=20
> When I tried to track it down, I didn't know if the kernel or qemu was wh=
at
> had it backwards, so it went back on the todo heap and composted...
>=20
> > > [*] I didn't have a big-endian userspace.
>=20
> That script builds one, the resulting binary tarball is at
> https://landley.net/bin/mkroot/0.8.13/sh2eb.tgz and the toolchain I used =
is
> at
> https://landley.net/bin/toolchains/25-03-2024/sh4eb-linux-musl-cross.tar.=
xz
> which was built with https://landley.net/toybox/faq.html#cross2
>=20
> There might also be something wrong with -hda block device support, I'd h=
ave
> to check my notes. But I can work around lack of -hda with nbd-server, ki=
nda
> hard to do it the other way...
>=20
> Rob
>=20
>=20

--=20
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net