-
Notifications
You must be signed in to change notification settings - Fork 7
Home
In this case, the best way to use it is to create a container. A script does all the job automatically for you :
scripts/debian-create-lxc.sh m68k
but before you must configure correctly your environment :
- copy (or link) lxc template lxc-cross-debian in /usr/share/lxc/templates/
for instance:
ln -s $PWD/scripts/lxc-cross-debian /usr/share/lxc/templates/
- configure binfmt interpreter using qemu-binfmt-conf.sh :
on non-debian/ubuntu
sudo scripts/qemu-binfmt-conf.sh --credential --qemu-path /bin
on debian/ubuntu
scripts/qemu-binfmt-conf.sh --credential --qemu-path /bin --debian
sudo update-binftms --importdir /usr/share/binfmts --import qemu-m68k
When the container is successfully created, you start it with :
sudo lxc-start -n virtm68k-etch-m68k
the 'root' password is 'root'. The network should be enabled, and you should be able to connect to your m68k container using ssh.
configure --target-list=m68k-softmmu
make
You must provide the kernel binary on the command line and a disk image (you can create the disk image using the container), for instance :
qemu-system-m68k -kernel vmlinux -append "console=tty console=ttyS0 root=/dev/sda1 init=/bin/bash" -serial mon:stdio -drive file=m68k.img,if=scsi -net nic
the init=/bin/bash
is needed because, qemu-system-m68k is not able to fork correctly a new process (what 'init' is doing intensively). A 'bash' will allow you to play a little.
I've added a script creating automagically a qemu disk image from a container:
sudo scripts/lxc-img m68k.img -l mac -n virtm68k-etch-m68k 10G
QEMU and LXC container provide us a perfect and stable build environment : no more needs of unstable and hard to produce cross-compiler, no more needs of broken cross-compiled libraries, etc, etc !!!
Just create an user in your container and add it to sudoers, then login and :
$ wget --no-check-certificate https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.7.tar.gz
$ tar zxvf linux-3.16.7.tar.gz
$ sudo apt-get install make gcc libc-dev bc
$ cd linux-3.16.7/
$ make mac_defconfig
you can add in your .config :
CONFIG_EARLY_PRINTK=y
then
$ make -j $(getconf _NPROCESSORS_ONLN) vmlinux
At this point, I feel free to appreciate the 4 hyperthreaded cores of my i7-4790 at 3.6 Ghz, my 8 GB of memory and my 1 TB SATA-3 disk to compile my m68k kernel, against the 33 Mhz 68040 of my old (and working) Quadra 800.
Just listen to the nice flow of the air crossing my computer to refresh my overheated CPU (I'm a "poète")[1]
Then, you can use it with the -kernel
option, providing the full container path, for instance :
-kernel /var/lib/lxc/virtm68k-etch-m68k/rootfs/home/laurent/linux-3.16.7/vmlinux
Again, use the container.
First, start the qemu-system-m68k
with the -s -S
to start and stop waiting the debugger connection.
Then run in the container, if it is not already done :
sudo apt-get install gdb
You can now debug you kernel running in qemu on the same host from your container :
gdb linux-3.16.7/vmlinux
target remote 10.0.3.1:1234
But the debug information of the kernel is only available if your .config contains:
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_REDUCED=y
CONFIG_DEBUG_KERNEL=y
CONFIG_KALLSYMS_ALL=y
CONFIG_FRAME_POINTER=y
- a french poet : "J'écoute avec satisfaction le doux écoulement de l'air traversant mon ordinateur pour rafraîchir mes processeurs surchauffés". BTW, did you ever hear the noise of a petaflopic computer running Linpack ? It's like the sound of a giant swarm of bees...