Wednesday, February 3, 2010

Installing OS161 on Solaris 10 x86

This post applies to Solaris 10 and later releases (x86) and for the old packages of os161.

As it is said that there's too much linuxism in the code of os161 I could not find a relevant Solaris Package for os161. So I had to install os161 on Solaris from this old package source.

So first of all you have to download this source package of os161.

   - cs161-binutils-1.4 
   - cs161-gcc-1.4-2 
   - cs161-gdb-1.4-2 
   - sys161-1.12-2 
   - os161-1.11 

We have to solve an incompatibility problem.

Existing incompatibility in packages,


Let's rename them.

mv /usr/bin/awk /usr/bin/tawk 
mv /usr/bin/nawk /usr/bin/awk 

Because nawk is default in Linux and exists with name awk. If you type ls
/usr/bin/*awk on Solaris you will see 3 different packages:

$ ls /usr/bin/*awk

Now set gnu make as default make

mv /usr/ccs/bin/make make.orig 
mv /usr/sfw/bin/gmake /usr/sfw/bin/make 

We did this because Solaris make does not work for gnu package. (These are the little difference between Solaris (Unix) and Linux.)

There's another way to use gmake as default. To modify an environmental variable:
    export MAKE=gmake

But this does not work always (maybe it does not totally replace make and in some way goes back sun's make).

Export /usr/ccs/bin and /usr/sfw/bin in PATH variable.

$ export  PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin 

* Extract the packages

$ gunzip ASST0.tar.gz 
$ tar xvf ASST0.tar 
$ gunzip cs161-binutils-1.4.tgz 
$ tar xvf cs161-binutils-1.4.tar 
$ gunzip cs161-gcc-1.4-2.tgz 
$ tar xvf cs161-gcc-1.4-2.tar 
$ gunzip cs161-gdb-1.4-2.tgz 
$ tar xvf cs161-gdb-1.4-2.tar 
$ gunzip sys161-1.12-2.tgz 
$ tar xvf sys161-1.12-2.tar 
$ gunzip os161-1.11.tar.gz 
$ tar xvf os161-1.11.tar.gz 


Download the attached support.h in current directory and replace

$ mv ./support.h os161-1.11/sbin/mksfs/support.h

I added some type definitions in the support.h file which were missing for Solaris x86 machines.

Now configure, build and install os161

$ cd cs161-binutils-1.4 
$ ./ 
$ export PATH=$PATH:$HOME/cs161/bin 
$ cd ../cs161-gcc-1.4-2 
$ ./ 
$ cd ../cs161-gdb-1.4-2 
$ ./ 
$ cd ../sys161-1.12-2 
$ ./configure mipseb 
$ make 
$ make install 
$ cd ../os161-1.11 
$ make 
$ cd kern/conf

Configure Fix

Download the attached config in current directory and replace (assuming you
extracted os161 in current directory or you have to cd to the directory that
contain os161-1.11 directory)

$ chmod a+x config
$ mv config os161-1.11/kern/conf/config

In that config file I just changed tr to /usr/xpg4/bin/tr
because it is linux equivalent

Booting the Kernel

$ ./config ASST0 
$ cd ../compile/ASST0 
$ make depend 
$ make 
$ make install 
$ cd ~/cs161/root 
$ cp sys161.conf.sample sys161.conf 
$ ./sys161 kernel-ASST0 

Tips and Tricks

If you have once installed os161 in your Unix or Unix-like operating system just keep a copy of all files. When you re-install Solaris update the path as it was done before and simply copy the files. Then change the ownership of the files and folders using this command as root

# chown -R userName:userGroup /home/userName/cs161 

You have got os161 installed without actually installing the packages. Have fun with Solaris.

Trouble shooting

A common error during building ASST1(for Lab1) is something like this:

$ gmake install 
gmake: cannot create ~/cs161/root

To avoid this error configure should be done using correct PATH prefix.

$ ./configure --ostree=/export/ar/cs161/root

~/cs161/root does not work in Solaris!

And I assure you will have no problem with installing ASST1 in Solaris.

No comments:

Post a Comment