frno7 / gentoo-mipsr5900el

Gentoo tooling for the PlayStation 2, with a Docker, and scripts to install cross-compilers, QEMU, and essential tools.
24 stars 3 forks source link

Build statically linked QEMU with binfmt_misc handler and no manual dependencies #3

Closed frno7 closed 2 years ago

frno7 commented 2 years ago

@AKuHAK, it’d be very good if

https://github.com/frno7/mipsr5900el-gentoo-linux-gnu/blob/9e01f44b0d5e04a496c8ac27e13494bf208eb63a/Dockerfile#L23

had USE=static-user, not only for greater compatibility mentioned in https://github.com/frno7/iopmod/pull/9#issuecomment-1105480840 but also, specifically for QEMU, its use with the schroot command, mentioned in https://github.com/frno7/linux/issues/33#issuecomment-555535394, and binfmt_misc to run R5900 programs as if they were normal for the host:

echo 0 >/proc/sys/fs/binfmt_misc/qemu-mipsel
echo ':qemu-mipsr5900el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' >/proc/sys/fs/binfmt_misc/register
frno7 commented 2 years ago

Commit 3e234f1fca19c8e212a4fddb7edd92dc9b498ce9 adds USE=static-user for QEMU/R5900. I will attempt to get rid of

https://github.com/frno7/mipsr5900el-gentoo-linux-gnu/blob/ec79a336b384b17204f9929663f2d4207e87ed87/Dockerfile#L35

which should emerge automatically by dependency. I’ve also prepared commit https://github.com/frno7/gentoo.overlay/commit/0d431244cece8de8cb37544584ee207101f3d3fb to install binfmt_misc, meaning R5900 programs will run as if they were native as x86_64, in the case of this specific Docker. It should be enough to do rc-update add qemu-mipsr5900el-binfmt, and since this Docker won’t reboot, also rc-config start qemu-mipsr5900el-binfmt, to make it ready.

frno7 commented 2 years ago

Automatic dependencies in commit 952c7506e6d2186d2c107d6308e74c9d157137e6.