Hi guys, as you seem ready to play with simulators to build debian m68k packages, I think it should be a good idea to play with the linux-user mode of qemu. Used with the linux containers, you can run real m68k users binary on an x86 kernel (it means gigabytes of memory, several CPU cores, Terabytes of SATA disks, gigabits ethernet, hundreds of virtual m68k machines on one host).
qemu linux-user mode traps guest (m68k) syscalls to translate them to native ones. It's not perfect. For instance, the clone() syscall seems to not work correctly (at least in one case, gnome-terminal), but you will, at least, be able to rebuild some packages. I don't think it is really usable for a debian buildd, but it can be used to develop and correct build issues. For instance, you can build glibc, kernel and gcc concurrently on one machine in less than a day ;-) The attached script will help you to test this. This script : - checks all needed stuffs are there (I'm not sure of the full list) - clones my qemu-m68k fork and compiles it - debootstrap and configures an etch-m68k root filesystem - configure binfmt to use qemu-m68k to load m68k ELF binaries - creates an LXC container for it run it with "sudo ./create-m68k-lxc.sh". I have tested it on an ubuntu 12.10 x86_64 system, and it seems to work fine. Default installation paths are: - /containers/m68k for the m68k root filesystem - $HOME/qemu-m68k for qemu sources - $HOME/lxc-m68k.conf for the LXC configuration file The name of the LXC container is virtm68k, but you can edit variables at the beginning of the script. Then you can start the container with "sudo lxc-start -n virtm68k", the system console is on the stdio. You can access the linux virtual consoles by running several "sudo lxc-console -n virtm68k". By default, on an Ubuntu 12.10 system, when lxc is installed, there is an interface "lxcbridge" allowing the virtual machine to access to network. By default the bridge is 10.0.3.1 and the virtm68k machine is configured with an eth0 on 10.0.3.128. "openssh-server" is not installed by default, but you can add it from the console with apt-get (don't forget to add a password for root). If you don't like this, you can destroy the container with "sudo lxc-destroy -n virtm68k", but, WARNING, it will also remove the directory ! Have fun, Laurent Note1: "sudo" will not work inside the container as "qemu-m68k" has not the SUID bit. Just log on on an alternate console as root. Note2: you can mount your host home directory using "mount -b /home /container/m68k/home", but don't forget to create your user inside... Note3: and for those that want to know the real power of their new m68k machine, I've added in attachement bogomips.c to compute the bogomips and the equivalent 040 cpu frequency. Mine (on a Q6600 a 2.4 Ghz) is: $ ./bogomips Clocking: 132 BogoMips: 104.00 Calibration: 524288
create-m68k-lxc.sh
Description: application/shellscript
#include <stdio.h> #include <time.h> /* * This is the number of bits of precision for the loops_per_jiffy. Each * bit takes on average 1.5/CLOCKS_PER_SEC seconds. This (like the original) is a little * better than 1% */ #define LPS_PREC 8 static inline void __delay(unsigned long loops) { __asm__ __volatile__ ("1: subql #1,%0; jcc 1b" : "=d" (loops) : "0" (loops)); } int main(void) { unsigned long ticks, loopbit; int lps_precision = LPS_PREC; unsigned long loops_per_jiffy; unsigned long bogomips; loops_per_jiffy = (1<<12); while ((loops_per_jiffy <<= 1) != 0) { ticks = clock(); while (ticks == clock()) ; ticks = clock(); __delay(loops_per_jiffy); ticks = clock() - ticks; if (ticks) break; } /* Round the value and print it */ bogomips = (loops_per_jiffy * 2) / ticks * CLOCKS_PER_SEC; printf("Clocking:\t%1g\n", (double)bogomips * 33 / 26 / 1000000 ); printf("BogoMips:\t%lu.%02lu\n", bogomips / 1000000, (bogomips / 10000 ) % 100); printf("Calibration:\t%ld\n", loops_per_jiffy); return 0; }