Sunday, September 19, 2010

Changing Default Kernels in Linux

A quick post (partly to keep this information handy in the future for myself):

How to change the default starting kernel in Linux (Ubuntu 10.04 to be specific, but these directions should work for other distros):

If GRUB1 is your bootloader:

sudo nano /boot/grub/menu.lst
Change default 0 to the number of the kernel you want to start automatically (list of available kernels at the bottom of the page, just below END DEFAULT OPTIONS)

If GRUB2 is your bootloader (default in 9.10 and later I believe):

nano /boot/grub/grub.cfg (look at the bottom of this file for the kernel you want and count which one it is (0 is the first, 1 is the second, etc)
sudo nano /etc/default/grub
If you want to have a menu display during bootup, comment out GRUB_HIDDEN_TIMEOUT=0. To change your default kernel, put the number in GRUB_DEFAULT. You can also use the full name which was visible in the /boot/grub/grub.cfg file, such as GRUB_DEFAULT="Ubuntu, with Linux 2.6.31-11-rt"

Well that's it for now. Have fun with custom kernels!

Friday, October 30, 2009

Routing Systems Presentation

Last night at the Bozeman LUG (Linux Users Group) I presented for the second time, this time on a comparison of routing systems. It specifically examined open source router software for use at 50+ person LAN events on campus. I ended up selecting pfSense, and have been happy with it ever since. If you're interested, the slides are linked below. Consider this a mini-review of DD-WRT, pfSense and Untangle from the perspective of some of the most demanding users on the planet: gamers at a LAN party.

Routing Systems: A Real Life Comparison

Tuesday, October 27, 2009

16-bit Assembly Compilation in 64-bit Windows 7

I'm taking Computer Organization and Architecture this semester, and as part of the class I need to write/compile some assembly programs. Unfortunately, due to the age of the class, all of the example code & what we're being taught is with respect to 16-bit DOS programs. So I was in the unusual situation of needing to compile code that won't run in my current OS (Windows 7 Professional-64bit).

After experimenting a while, I got the following setup to work:

1. Installed Visual Studio 2008 & all associated updates
2. Downloaded & extracted a 16-bit compatible linker using a VM running XP (any box running XP will be able to extract it)
3. Created a folder for the assembly programming, made sure the link.exe from (2) was inside the folder.
4. Created a batch file (compile.bat) to automate the compile/linking process:
//start batch file
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\ml.exe" /omf /Bllink16 /Zm %1.asm
LINK.EXE %1.obj,%1.exe,,.lib,nul.def
//end batch file
5. Begin writing programs. To compile, simply type "compile helloworld" (WITHOUT the .asm)
For example, here's a sample run of a famous program:
//begin console
c:\Assembly>compile hello

c:\Assembly>"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\ml.exe" /
omf /Bllink16 /Zm hello.asm
Microsoft (R) Macro Assembler Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

Assembling: hello.asm

c:\Assembly>LINK.EXE hello.obj,hello.exe,,.lib,nul.def

Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright (C) Microsoft Corp 1984-1993. All rights reserved.
//end console
6. Finally, to test the compiled programs I run them inside a DOSBox instance (as Win7-64 doesn't run 16-bit programs).
//begin console
Hello, World!
//end console

Hopefully this helps someone running into the same issues I did.