Tuesday Jul 15, 2008

Though there are a lot of documents made available by sun about building opensolaris from source code, I think they are a bit overwhelming  for a beginner. So, here I am adding one more article to the list of documents available on the topic of building Solaris from source code which I'll try to make as simple as possible for a beginner to understand.

In order to build from source, four things are needed.

1. encumbered binaries tarball (on-closed-bins-DATE.PLATFORM.tar.bz2).
2. source tarball (on-src-DATE.tar.bz2; numbered builds only)
These two together constitute the child workspace.

3. ON build tools package (SUNWonbld-DATE.PLATFORM.tar.bz2). This provides the custom tools required for building opensolaris like nightly and bldenv. 4. compiler (Sun Studio 11 is the preferred compiler, and it is free for OpenSolaris community members.)

The first three can be obtained from the link below.
http://dlc.sun.com/osol/on/downloads/current/

Select the appropriate tarballs according to your architecture
(sparc or x86). 
The install image for the SUN Studio 11 compilercan be obtained from
the link below
http://opensolaris.org/os/community/tools/sun_studio_tools/
sun_studio_11_tools/

Now, to install the compiler from install image, follow the following steps.
1. Check that there is enough space in /opt. You can do this by cheking the
output of 'df -h /opt'. If the 'avail' field is 900M or larger, you can continue.
2. Become root. After that do
   # cd /opt
      # bzip2 -dc /var/tmp/sunstudio11-20050614.sparc.tar.bz2 | tar xf -   
Here, I have assumed the install image to be in /var/tmp. Please place
the exact path and name of your image file in the command above.

Now, to install the build tools, suppose you have downloaded them in 
/var/tmp, then do:
  # cd /var/tmp
  # bzip2 -dc SUNWonbld-DATE.PLATFORM.tar.bz2 | tar xf - 
  # su
  Password:
  # pkgadd -d onbld SUNWonbld

After this, the workspace needs to be created. Suppose you have
/export/home/testws as your child workspace. Now, unpack the 
source and closed binaries here i.e.,
  # cd /export/home/testws
  # bzip2 -dc opensolaris-src-DATE.tar.bz2 | tar xf -
  # bzip2 -dc opensolaris-closed-bins-DATE.PLATFORM.tar.gz | tar xf -
The source will unpack into usr/src and the closed binaried into 
closed/root_PLATFORM/

Now comes the final stage of performing the build. Copy the file
opensolaris.sh into /export/home/testws, i.e.,
  # cp /export/home/testws/usr/src/tools/env/opensolaris.sh    
     /export/home/testws

Now make the following changes in the copied file.
  • Change GATE to the name of the top-level directory (e.g., testws).
  • Change CODEMGR_WS to the top-level path (e.g., /export/home/testws).
  • Change STAFFER to your login.

Add /opt/onbld/bin as well as /opt/SUNWspro/bin to your path.
After having done all this, type
  # nightly ./opensolaris.sh &

This starts the nightly build. You can find something else to do for a few hours. The progress of the nighlty can be examined by typing the command 
  # tail -f  /export/home/testws/log/nightly.log

After nightly gets completed, a mail is sent $MAILTO field mentioned in the opensolaris.sh file. In case the nightly fails, correct the problem and add the '-i' option to nightly to do an incremental build so that it does not start from scratch.

This is just one way of performaing the build. There are a lot of other options available. For more indepth information, you can refer to the links given below.

Building ON from source
ON Downloads page
OpenSolaris README


Thursday Jun 26, 2008

 If you are new to VirtualBox and are searching for a reference to get you started, I believe my other blog entry on "Running OpenSolaris 2008.05 inside VirtualBox on a Solaris x86 host" is the right place for you.

If you are already done with the initial installation of VirtualBox and your guest OS, then I believe this is the place for you. Getting started with VirtualBox, there are a few things that I think one should know.

NETWORK SETTINGS

The "Network" tab under the Settings of a virtual machine lets you decide how the VirtualBox presents a Virtual NIC to the VM. There are four options for the network card.

  •  AMD PCNet PCI II;
  •  AMD PCNet FAST III (the default);
  •  Intel PRO/1000 MT Desktop;
  •  Intel PRO/1000 T Server.

When you start your Guest VM, the VirtualBox enables one of these by default for you and enables the NAT mode for it. This way, the guest VM can connect to the outside world. AMD PCNet FAST III is the default because it is supported by almost all operating systems.

GUEST ADDITIONS

For any serious and interactive use, the VirtualBox Guest Additions will make your life much easier by providing closer integration between host and guest and improving the interactive performance of guest systems. Guest additions is basically a set of drivers which provide the following features:

1. Mouse Pointer Integration: With guest additions, there is no need to Capture and release the mouse to switch between the host and the guest. It provides seamless mouse support without any need of the host key.

2. Better Video Support: The custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes as well as accelerated video performance.

3. Shared Folders: This provides a way to share files between the Host and the Guest OS. You can specify a folder on the Host as shared for the Guest and VirtualBox will make it available to the guest OS as a network share.

4. Shared Clipboard: With Guest additions installed, the clipboard of your guest OS  can be shared with your host OS.

 There are many more features provided by Guest Addditions. Refer to the User Manual of VirtualBox for them.

Installing Guest Additions

In order to install guest additions, go to the devices tab. There, select "Install Guest Additions" option. This will automatically mount the VBoxGuestAdditions.iso
Alternatively, go to the Mount CD/DVD ROM option. In that, select the CD/DVD ROM image. In the window that opens, browse to the directory containing VBoxGuestAdditions.iso. It will be /opt/VirtualBox for Solaris host.

After mounting, the VirtualBox provides the ISO image as a CD to the Guest OS. Now, run the following command:

pkgadd -d /media/VBOXADDITIONS_1.6.2_31466/VBoxSolarisAdditions.pkg

Here, VBOXADDITIONS_1.6.2_31466 is the name of the CD which gets mounted in /media.

After the installation is complete, you need to relogin to the XServer on the guest to enable the X11 Guest Additions.

Enabling Shared Folders

In order to share a folder between the host and the guest, you have to first create a folder on the host OS exactly the way you want it on the guest. Then, in the guest OS, go to devices -> shared folders. The window below opens.


In this window, there are two options: Machine Folders and Transient Folders.  The Machine folder option defines shared folders that are available only to the VM for which they have been defined. The transient folder option defines shared folders which can be added or removed at runtime and do not persist after a VM has stopped.

In the Machine Folader option, browse to the folder to be shared on the host and give it a name by which it will be visible in the Guest OS. Now, the shared folder will be available for mount like a normal network share.

In order to mount, type

mount -t sharename mountpath

where sharename is the name given to the shared folder and mountpath is the path where you want ot mount the folder.


Okay..so since the last many days..I had been wanting to try out the latest release of Solaris i.e., OpenSolaris 2008.05 (project Indiana as SUN calls it). I tried out the live CD and I must say was damn impressed by the impressive GUI. I wanted to install it but already have Soalris 10 on my computer. That was when the idea of using VirtualBox came to my mind.

Here I will give a detailed overview of VirtualBox telling how to get OpenSolaris 2008.05 running as a guest OS on a Solaris 10 host.

INSTALLING VIRTUALBOX

You can get binaries for all platforms from the site below.The site also contains a user manual which is more than sufficient to get you through the initial installation procedure.

http://www.virtualbox.org/wiki/Downloads

 For installing VirtualBox on a Solaris x86 host, first download the appropriate package. The installation must be performed as root and from the global zone because the VirtualBox installer has to load kernel drivers which cannot be done from a non global zone. After that, run the following command from terminal.

gunzip -cd VirtualBox-1.6.2-SunOS-x86.tar.gz | tar xvf -

After this, you will have two packages: VirtualBox-1.6.2-SunOS-x86-r31466.pkg and VirtualBoxKern-1.6.2-SunOS-r31466.pkg. The second package is the VirtualBox kernel interface (vbi). The purpose of this module is to shield the VirtualBox kernel driver from changes to the SunOS kernel. If you do not have vbi already installed (check for the existence of the file /platform/i86pc/kernel/misc/vbi) install it by executing the command:

pkgadd -G -d VirtualBoxKern-1.6.2-SunOS-r31466.pkg

After that install VirtualBox by executing the command:

pkgadd -d VirtualBox-1.6.2-SunOS-x86-r31466.pkg

This completes the installation procedure. Virtualbox will be installed in /opt/VirtualBox.

RUNNING VIRTUALBOX

To run VirtualBox, simply type VirtuaBox in your terminal. Alternatively, you can also run it from Applications -> System Tools -> Sun xVM VirtualBox. This should bring up a window like the one shown below on your desktop.



Since I already have a Virtual Machines with OpenSolaris 2008.05 guest created in my VirtualBox, it is showing it in the list of Virtual Machines on the left hand side. For a freshly installed VirtualBox instance, the left hand side will be empty. Now I will tell you how to create a new Virtual Machine instance.

CREATING A NEW VIRTUAL MACHINE INSTANCE

Click on the New option on the Left hand side in the above window. This will bring up the "Create New Virtual Machine" window. 



In this window, click on next. You will be prompted to enter a name for your Virtual Machine. Although you can enter anything here, it will be better to have something sensible so that when the number of VM's increase, it is easy to distinguish a VM by its name. Here since I was installing OpenSolaris 2008.05 inside my VM, I gave it the name OpenSoalris 2008.05.


 Select the OS type as OpenSolaris and click next. In the next window, you have to select the RAm for your VM. This means that when your VM is running, this much amount of RAM will be taken away from your host and will be provided to your guest VM. Select this carefully, it should be enough for your guest VM to run properly and your host should be left with enough to perform its functions. Here, I have selected 512 MB as my total RAM is 1024 MB.


Next, you have to select your virtual hard disk. Since yours will be a freshly installed VirtualBox, there won't be any existing Virtual Disk Images (.vdi). If you have a vdi, you can go to the existing option and select the vdi from there. Else, you can create a new vdi by clicking on 'New'. This will bring up the "Create New Virtual Hard Disk" wizard. Click on next, this will bring you to the window where you have to select the type of image you want to create. There are two options here:

  • A dynamically expanding file will only grow in size when the guest actually stores data on its virtual hard disk. It will therefore initially be small on the host hard drive and only later grow to the size specified as it is filled with data.
  • A fixed-size file will immediately occupy the file specified, even if only a fraction of the virtual hard disk space is actually in use. While occupying much more space, a fixed-size file incurs less overhead and is therefore slightly faster than a dynamically expanding file.

After selecting the type of image, click on next. Now, select a size for your vdi. This should be enough for your the contents of your guest OS and the applications you want to install. I selected 10 GB here. You can also specify a name for the image and the location where it gets stored. Next, it will confirm the details and clicking on finish creates the new vdi.

 After having created the vdi, select that from the existing ones and proceed. The next window shows all the details for the VM. Check them and click on finish. This creates a new VM with the given specifications. Note that all these settings can be changed after the  VM has been created from the settings tab.

Now the left hand side should be showing your newly created VM.


This VM is empty at present. In order to install a guest OS in it, you have two options:

  • In order to install from an actual CD or DVD, you should put the media in your host 's CD or DVD drive and then in the settings tab, go to the CD/DVD ROM option. There check the mount CD/DVD drive option and select host CD/DVD drive.
  • You can also install your guest OS from an ISO image. In order to do that, select the ISO image file option in the CD/DVD ROM option in the settings tab. From there, browse to the iso image file.


Now, you should start the VM from the 'Start' button on the top. This will bring up your VM and the installation will start from whatever media you provided. After the installation is complete, you can use your VM normally.

Below is a screenshot of OpenSolaris 2008.05 running inside the Vm on a Solaris x86 host.


Thursday Jun 12, 2008

The zpool history buffer is stored as a dmu object containing <packed record length, record nvlist> tuples. The buffer contains the 'zpool create' history in the beginning followed by the rest of the records. The 'zpool create' history is never overwritten, while the rest of the buffer is implemented as a ring. The details about the zpool history buffer layout can be fetched from the spa_history_phys_t structure which is stored in the bonus buffer of spa_history object. The structure has the following fields

1. sh_pool_create_len: This field represents the ending offset in bytes of where the 'zpool_create' record is stored.

2. sh_phys_max_off: This field represents the physical ending offset in bytes of the log. So, it gives us the total length of the buffer.

3. sh_bof: This is the logical beginning of file. In case some records have been overwritten, which can be got from the sh_records_lost field of the spa_history_phys_t structure, the spa_history_log_to_phys function is used to convert the logical value to the physical value. If the sh_records_lost=0, then the logical bof is same as the physical bof.

4. sh_eof: This is the logical end of file. In case some records have been overwritten, which can be got from the sh_records_lost field of the spa_history_phys_t structure, the logical end of file exceeds the sh_phys_max_off . In this case, the spa_history_log_to_phys function is used to convert the logical value to the physical value within the buffer.

5. sh_records_lost: The last field is sh_records_lost which tells us the number of records overwritten. The history buffer is implemented as a ring except the 'zpool create' history. When the end of buffer is hit, the previously stored records are overwritten starting from the sh_pool_create_len, the offset where the zpool create history ends. So, the zpool_create history is never overwritten.

The zpool history buffer exists in memory as a packed nvlist. The packed nvlist contains a nvs_header_t structure at the beginning which stores the host endian and the encoding_type. The header is followed by a stream containing <size of the nvpair, nvpair> tuples. There are two types of encoding methods:

1. Native encoding

2. XDR encoding

The format of the packed nvlist for the XDR encoding is :

  •   encoding methode and host endian (4 bytes)
       - nvl_version (4 bytes)
       - nvl_nvflag (4 bytes)

  •     encoded nvpairs, the format of one xdr encoded nvpair is:

       - encoded size of the nvpair (4 bytes)
       - decoded size of the nvpair (4 bytes)


       - name string, (4 + sizeof(NV_ALIGN4(string))
         a string is coded as size (4 bytes) and data
       - data type (4 bytes)
       - number of elements in the nvpair (4 bytes)
       - data

  •    2 zero's for end of the entire list (8 bytes)

The format is similar for native encoding wherin the first 4 bytes are occupied by the header followed by  the nvpair tuples. Each nvpair tuple  has the format <decoded size of nvpair( 4 bytes), packed nvpair> .

For decoding a packed nvlist, first the host endian and the encoding type is get fron the nvs_header_t structure in the beginning of the buffer, Then depending on the type of encoding, the appropriate functions are called to read the size of the nvpair from the nvstream and then read in the nvpair. This continues until the end of file is reached. In the case of zpool_history buffer, the encoding type used is native encoding.





Sunday Mar 23, 2008

 So, your aim is to burst some myths about SUN's web infrastructure services. The contest is mutual, set gets to murst the myths about its web services and you get to win $250 every month. Fair enough..ain't it!!!

Here's what you have to do...

Your mission, is to bust a myth that might keep an organization from selecting Sun as their choice for building a web infrastructure. You are to create a response that refutes a myth, and post it on the Internet. It can be a homemade video, podcast, blog or any other tool you have at hand that can be posted to the Internet.

DURATION:-March 1, 2008 through June 30, 2008

Each month will present a different myth challenge to bust. Below is the list of Myth's

Date Myth of the Month
March 1 - 31, 2008 "Sun's web solutions are proprietary"
April 1 - 30, 2008 "Linux is less costly for web infrastructure than Solaris"
May 1 - 31, 2008 "Sun is not relevant in the web space"
June 1 - 30, 2008 "It is impossible to transition to the better Sun Web Infrastructure from what I have installed today"

Create a response to the Myth of the Month and prove it to be myth. Post it anywhere on a publicly accessible internet site, and submit an entry form with the URL of your response. Eligible entries will be judged on effectiveness in busting the myth, appropriate length, use of supporting evidence, humor, and creative use of communication methods/language.

So, what are you waiting for...go on and burst the MYTH!!!

Monday Feb 18, 2008

Hi All, After making the students familiar with Solaris in the initial workshops, I focussed on Netbeans this month here at IT-BHU. Since my main focus was first and second year students who are yet to learn Java and hence use a Java IDE, I tried to make netbeans appear simple, friendly and easy to use so that it is their first and obvious choice :). The talks that I gave on Netbeans were attended by people from other branches also like electrical and electronics. Initially, I tried to make them familiar with the basic environment by setting up a simple project, showing the code editor demo, using the debugger etc. Like everybody, I was also faced with the million dollar question of Why Netbeans and not Eclipse??? Thanx to the page provided on the educommons site, I answered it beautifully highlighting all the areas where Netbeans scores way above eclipse.
The speed problem was also addressed and I provided them with the tip given to us by gopal sir at the induction program.
Then the basic session was followed by a hands on session where I gave the students demos on Matisse GUI Builder and Plugin Module Development. A nice experience overall and hope I have been able to set good grounds for future workshops related to Netbeans!!!

Thursday Jan 10, 2008

Finally I had my first Solaris workshop at IT-BHU!! Response was awesum!! More than 80 people turned up and there wasn't any place left to sit....coz of that sum people preferred to stand and watch it!! :). I covered many topics related to Solaris like installation, Network configuration, Package management, multibooting Solaris etc. Many obvious questions came like why Solaris..which I think I answered beautifully highlighting ZFS, DTRACE and SMF. Also questioning like why netbeans is better than eclipse were asked. Many people came to me afterwards asking more details about multibooting Solaris.Thanks to the bulky document provided by educommons, I was able to answer all.. ;). All in all a nice experience. Waiting to have many more sessions like that!!

Sunday Dec 09, 2007


If you are a windows addict and are stuck with a file that is in ODF (open document format)..here's a solution.
Get the SUN ODF plugin for MS Office.
http://www.sun.com/software/star/odf_plugin/get.jsp

After having downloaded and installed the plugin,it will automatically become visible in MS excel, word, powerpoint etc. If it does not, here is what you should do..
1. In Excel, choose Tools - Add-Ins...
2. Click the Browse button.
3. Navigate to the installed file odfaddin.xla. This file resides in a folder like "c:\Program Files\Sun\Sun ODF Plugin for Microsoft Office\converter"
4. Click the odfaddin.xla file and click OK. (To stop using the plugin, uncheck the plugin in the Add-Ins dialog box.)

  • In order to use the plugin, start Microsoft Word, Excel, or PowerPoint. In Word, the ODF format is available as an additional filter in the file dialog.
    An additional toolbar in Excel and PowerPoint shows the icons "Import ODF" and "Export ODF".
  • To open an ODF file in Word, choose File - Open. In the dialog, select the file format "ODF Text Document (*.odt)", then select any file with the extension *.odt.
    In Excel, choose File - Import ODF Spreadsheet. In the dialog, select any file with the extension *.ods.
    In PowerPoint, choose File - Import ODF Presentation. In the dialog, select any file with the extension *.odp.

  • To save an ODF file in Word, choose File - Save or File - Save As. In the dialog, select the file format "ODF Text Document (*.odt)", then enter a name for the file.
    In Excel, choose File - Export ODF Spreadsheet. In the dialog, enter a name for the file.
    In PowerPoint, choose File - Export ODF Presentation. In the dialog, enter a name for the file.


PS:"Saving" versus "exporting": In Word, you can save the current document directly in the OpenDocument format. In Excel and PowerPoint, you can only export to ODF. When you save to ODF, from that moment on you are working on the ODF document. When you export to ODF, a snapshot of the current document is written to an ODF file, but you still work on the same document that you once opened.
Hope this proves useful!!! blogs.sun.com/images/smileys/smile.gif" class="smiley" alt=":)" title=":)" />

Hi all..I am Saloni Arya, Campus Ambassador of SUN for IT-BHU, Varanasi. It may come as a surprise, but I am myself a novice in this field of Open Source Software. I am trying to learn fast and as much as I can, but still sometimes, I find myself lost in this big world!! Through my blog, I would try to help all the newbies out there with all the knowledge and experience I gather as I make my way thorough this vast and amazing world of OpenSource. On my blog, you can expect varied kinda stuff, from technical information on netbeans, Solaris and Java to my own personal experiences with these stuffs... Hope all the open source gurus out there share there wisdom by posting valuable comments on the posts and all the newbies benefit from the stuff posted...seeya around :)!!!!

This blog copyright 2009 by Saloni Arya