Building the Bochs BIOS

From Zet
Jump to: navigation, search

Here is a guide to making a Kubuntu Virtualbox and getting and building the Bochs Zet BIOS (and VGA BIOS) on it.

Please note if you actually run with Linux there is no need to build the BIOS in a Virtualbox, and you can skip straight to the instructions of how to build the BIOS in Kubuntu Linux.

Making your Linux Virtual Machine

  • Download and Install Virtualbox for your platform, you can find the download here. If you feel you need any instructions you can find them on the Virtualbox website.
  • Download the Kubuntu ISO Image from a server near you from here.
  • Start Virtualbox.
  • Click the New button in the top left hand side of the window.
  • Follow the prompts to Create a Kubuntu Virtual machine and Hard Disk (I usually give the Virtual machine a bit more than it offers but do not leave you host machine too short of RAM, I used 768MB RAM, 16GB Drive).
  • Before starting it right click on your new Virtual machine and click settings.
  • Click on the CD/DVD-ROM Setting and tell it to mount the ISO you downloaded at stage 2. Yo will need to add the .ISO to the Virtual Media Manager before you can select it.
  • Now Launch your new virtual machine. Note until Guest Additions are installed later in the process you will have to press the right control button to get the mouse pointer out of the guest window this will be resolved later.
  • Your virtual machine should launch. Select Install to the Hard disk, the Kubuntu Installer should then start.
  • Follow all the prompts to get your Virtual Machine Installed, select use the full hard disk when prompted.
  • It will prompt you to reboot at the end of the process. It is good practice to Unmount (remove) the CD as it reboots in the installed Linux for the first time. You may have to totally shut the virtual machine down rather than just restarting as the Live CD that the OS is installed on locks the optical drive making it hard to remove the disc.
  • If you are full screen then press the right control key with the f key to come out of full screen.
  • Click the "CD/DVD-ROM" setting on the menu bar and change the .ISO image to the VBoxGuestAdditions.iso.
  • Use the File Manger (Dolphin) to copy the additions install file from the root of the CD to the root of your home drive (or a subdirectory of your home drive if you prefer)
  • start up a command shell by clicking the KMenu->Applications->System->Console (Konsole)
  • (If you put the install file in to a different directory use the CD command to go there now)
  • type "sudo ./VBoxLinuxAdditions-x86.run" and hit Enter. Note I would normally type "ls" Return at the prompt and then copy the file name and select paste at the point you would need to type it in! - or easier still you can use filename completion (<TAB> key).
  • The Virtual Machine will then spend a couple of minute installing the guest editions.
  • you will need to type the password you used as your user password for the Kubuntu system.
  • The command line will remind you to restart which you should do.
  • If all is well you should now have the Virtualbox additions installed to allow the virtual machine to work seamlessly with the host machine.
Note there are many settings and other things you can experiment with in your new Linux Virtual PC and the settings you can set for the Virtual Machine, but that is beyond the scope of this guide! Feel free to experiment.

You are now ready to proceed to the next phase which involves actually using the Linux you have installed.

Preparing Linux to build the BIOS

If you are using your existing Linux set up or a new Virtualbox one made using the instructions above you are unlikely to have all the software installed on you PC that you will need to build the BIOS. In this section we explain how to get all the software need to build the BIOS installed on your Linux machine. These instructions are for Kubuntu but can probably be used for any Debian derived Linux Distribution, getting the tools you need from most other distributions is also going to be largely similar.

Installing packages (software) can be done using GUI or from the command line. It really makes no difference which way you do it as long as you get the packages required. I used the GUI KPackageKit (KMenu->Applications->System->Software Management).

The list of packages required

  • build-essentials (This was already installed on the latest Kubuntu I tried)
  • bcc (I had to install this)
  • git (git is optional as you can get the code in zip or tar.bz2 form from this very wiki from the Zet_processor page.)

Preparing to build the Zet BIOS

Now we get to the easy part, actually building the BIOS.

  • Get the Zet project on to a directory of your home directory (I used the name Zet), you can use the existing archives from the wiki page Zet_processor or by pulling it from the Zet git repository.
  • Start a Console (as before) and type "cd ~/Zet/src/tools" and press return.
  • Type "gcc ff.c -o ff" and press return, this should complete without warning/ error messages.
  • Type "cp ff ../../bin/ff" and this should copy the newly built ff tool to the bin directory.

We should now have everything we need to build the BIOS, just one more step.

Building the BIOS

  • Start a Console (as before) and type "cd ~/Zet/src/bios"
  • type "make" and press enter. If all is well the BIOS should build and you should have a bios.out file.

Folder sharing to get the files between your Virtual Machine and Host

It is good that we now have the BIOS, but it is on the Virtual PC and not the Host (Probably Windows) PC that actually has the Altera Quartus II tools installed. We need to get the file over to the Host. There are two main ways of doing this, both involve Shared Folders which are Folders (Directories) that both the Host and the Virtual Machine.

  • We can just make a shared folder an use it to copy the bios.out to the windows machine
  • We can make a shared folder and place the whole of the Zet directory on it so the bios.out (and all the other Zet files) are seen by both Host and Virtual Machine.

The second approach is more powerful but both methods will work.

The Virtualbox forum has a post on setting up Shared folders on Linux Guest which you should follow.

At the time of writing this Virtualbox 2.2 has a major bug relating to Shared Folders which make these instructions very difficult to follow, lets hope this is resolved soon. In the meantime do not use the file browser to add a share but paste/type the path directy in to the "Folder Path" box of the "Add Share Dialog".

Using Git

Source control is an automated way of getting (downloading) and putting back (uploading) files such as software, HDL, configuration files and data files. Git is a relatively new source control system and one which has the interesting way of working in that every user has there own complete tree of the project. They can then work on that tree in isolation until they want to put the changes back. This differs from traditional source control systems that have a single central repository where all the files are kept.

If you get involved in developing Zet in a big way you are likely to want to use Source control to pass your improvements back to the project and also to get the very latest files (even before they are released as an official version).

I (FordP) the original author of this page is very new to git so I can only point you to the documentation on the website. Hopefully this page can be improved in the future to better explain the git "get latest" and "check in" process as I am totally unqualified to comment. I therefore draw your attention to the Git website and the Windows Git Website for further reading!