I do math. I do a lot of math. Between semiconductor simulations, and custom software, I care only about how many hours/days I can speed things up. I still use my Pismo (603e, 1GiB) occasionally because certain long multiplies are still faster than on my spiffy new i7 because I can cache lock, and other tricks (in full disclosure, x86 is the architecture that I care the least about because the ISA is terrible, but you have to applaud Intel for almost 40 years of binary compatibility and Microsoft for Windows upgrading so well for so long)
Problem: I upgraded to MacOS 10.11 from 10.9, and it broke things.
Solution: Upgrade software to make it work again.
What I first noticed with VirtualBox, after the upgrade to 10.11, was that some of my cmos14soi work took 8hrs to validate instead of 1. They paradigm when from "go make coffee" to go to bed. At this point, I had nothing but regret, but you need to live in the moment. I cannot downgrade to 10.9, so I just have to make what I have work better, thus:
Time to figure out the optimal virtualbox linux kernel
As currently, there is an 8x increase in time over my previous setup, and I'm about to start a new IC, I want to be sure that I optimize my time, even if it takes all day. Firstly, I wanted something quantitative to see what the difference would be, so went looking for a speed test suite. I created a file that loops through all simon 32/64 values for a random key:
main.quick.c. (In the same repository is main.c, but you don't want to use it. It acts like SPICE does with file writes, but it takes days to run.) Compiling main.quick.c by "cc main.quick.c -o quick", the results where as follows for my 2.8 GHz Intel Core i7 Macbook Pro with 16GiB RAM
native, 15.2.0 Darwin: 844 seconds
emulated 2CPU, linux-3.2.0: 1131seconds
emulated 1CPU, linux-3.2.0: 1119 seconds
My virtualbox settings I'm sure were default, except I use 10GiB of RAM for the VM. If you think about this, it would make sense that a minimal, non-SMP kernel is the way to go with Linux under emulation, so I will use that. Go into virtual box and select 1 processor, turn off sound. Now to make the kernel. I happen to be using Debian, and I
read a lot of documentation.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git fakeroot build-essential libncurses-dev xz-utils libssl-dev bc wget
The next thing to do is install the kernel package.
$ sudo apt-get install kernel-package
Why this package requires libmail-sendmail-perl, I will never know.
Now to get the most recent kernel, which I put in /usr/src/. I am going to rebuild the kernel that I have because I do not want to break any of my tools.
$ cd /usr/src
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.76.tar.xz
I jest, but the last kernel that I compiled was 2.0.38. That was 1996 and I moved to BSD. I prefer BSD, but my tools require Linux and a license. I decided to use the 3.2.x kernel because my toolkits already use 3.2.1 and I have some modules that are specific to my tools.
Once the kernel arrives, you need to unpack it and enter the top directory.
$ tar xvf linux-3.2.76.tar.xz && cd linux-3.2.76
Now we are to the building the kernel part. It's choose your own adventure! You can either build your own, or use the configuration file that I used. If you want to build your kernel with options you specify yourself, type:
$ make menuconfig
If you want to just use my configuration, you need the
.config file.
$ wget https://raw.githubusercontent.com/bpdegnan/simonsays/master/config-3.2.76
The .config file is just what the result of what is created my "menuconfig".
Now we are to the part that is "Debian-style". We are going to make the kernel as a package. Building the kernel will take awhile.
$ make-kpkg clean
$ fakeroot make-kpkg --initrd --revision=1.0.VBOX kernel_image kernel_headers
At this point, the package is built. If you put your source in /usr/src, you will find to .deb files in the directory. The first is the linux-headers-
and the next is the linux-image- You then need to install these, as they are your new kernel and headers.
$ sudo dpkg -i *.deb
Using the dpkg tool to install the kernel also updates the bootloader.
So here's the kicker. The new kernel is much slower than the previous one.
emulated 1CPU, linux-3.2.76: 1127 seconds
I will have to dig deeper into this when I get a chance.