Building and booting the OpenSolaris Kernel
I spent some portion of this week preparing slides for an OpenSolaris Kernel talk I gave yesterday at campus and that I'm repeating Saturday at a TcheLinux event. I'll post some pictures and the slide deck after the Saturday session.
The last three or four slides are about building/booting the kernel and I thought it might be interesting to post the steps here. This is for x86 but the SPARC version is just about the same.
Downloading the goods:
1. $hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate my-copy
Here's a tip to allow compression. It should decrease your download time:
Edit your .ssh/config file and add
Host *opensolaris.org
Compression yes
2. Go to http://dlc.sun.com/osol/on/downloads/current/ and download SUNWonbld.i386.tar.bz2.
3. Get and read (really) README.OpenSolaris.
Installing the ON build tools
1. pkgrm SUNWonbld
2. bunzip2 -c SUNWonbld.i386.tar.bz2 | tar xf -
3. pkgadd SUNWonbld
Setting your environment
1. cp usr/src/tools/env/opensolaris.sh my-copy
2. gedit opensolaris.sh
3. set GATE to my-copy
4. set CODEMGR_WS to my-copy's path
5. set STAFFER to your login
6. set VERSION to whatever you wanna call it
Building the kernel
1. bldenv -d ./opensolaris.sh
2. cd /usr/src/uts
3. dmake all
Because we didn't do nightly ./opensolaris & before, /src/tools/proto isn't built.
So just go there and build it.
Building the tools
1. cd /usr/src/tools
2. dmake all
Booting
1. Install -G my.kernel -k i86pc
2. su
3. cd /
4. tar xf /tmp/Install.my.kernel .
5. gedit /boot/solaris/filelist.ramdisk
6. add /platform/i86pc/my.kernel to the end
7. gedit /boot/grub/menu.lst
8. add an entry pointing kernel to my.kernel
9. reboot
First steps towards developing:
1. gedit /usr/src/uts/common/main.c
2. add printf("Hello Kernel World!\n"); somewhere halfway through main()
3. recompile, install and reboot!
Cool huh? :)