Build process

The build process of JNode consists of the following steps.

  • Compilation - Compiles all java source to class files.
  • Assembling - Combines all class files into a jar file.
  • Boot image building - Preloads the core object into a bootable image.
  • Boot disk building - Creates a bootable disk image.
  • CD-ROM creation (optional) - Creates a bootable CD-ROM (iso) image

Boot image building

When JNode boots, the Grub bootload is used to load a Multiboot compliant kernel image and boot that image. It is the task of the BootImageBuilder to generate that kernel image.

The BootImageBuilder first loads java classes that are required to start JNode into there internal Class structures. These classes are resolved and the most important classes are compiled into native code.
The object-tree that results from this loading & compilation process is then written to an image in exactly the same layout as an object in memory is. This means that the the necessary heap headers, object headers and instance variables are all written in the correct sequence and byte-ordering.
The memory image of all of these objects is linked with the bootstrapper code containing the microkernel. Together they form a kernel image loaded & booted by Grub.

Boot disk building


To run JNode, in a test environment or create a bootable CD-ROM, a bootable disk image is needed. It is the task of the BootDiskBuilder to create such an image.

The bootable disk image is a 16Mb large disk image containing a bootsector, a partition table and a single partion. This single partition contains a FAT16 filesystem with the kernel image and the Grub stage2 and configuration files.

Build & development environment

This chapter details the environment needed to setup a JNode development environment.

Sub-Projects

JNode has been divided into several sub-projects in order to keep it "accessible". These sub-projects are:

JNode-All The root project where everything comes together
JNode-Core The core java classes, the Virtual Machine, the OS kernel and the Driver framework
JNode-FS The Filesystems and the various block device drivers
JNode-GUI The AWT implementation and the various video & input device drivers
JNode-Net The Network implementation and the various network device drivers
JNode-Shell The Command line shell and several system commands

Each sub-project has the same directory structure:

<subprj>/build All build results
<subprj>/descriptors All plugin descriptors
<subprj>/lib All sub-project specific libraries
<subprj>/src All sources
<subprj>/.classpath The eclipse classpath file
<subprj>/.project The eclipse project file
<subprj>/build.xml The Ant buildfile

Eclipse

JNode is usually developed in Eclipse. (It can be done without)
The various sub-projects must be imported into eclipse. Since they reference each other, it is advisably to import them in the following order:

  1. core
  2. shell
  3. fs
  4. gui
  5. net
  6. builder
  7. distr
  8. all
  9. sound
  10. textui
  11. cli

For a more details please have a look at this Howto.

IntelliJ IDEA

JetBrains Inc has donated a Open Source License for Intellij IDEA to the dedicated developers working on JNode.

Developers can get a license by contacting Martin.
Setup of the sub-projects is done with using the modules feature like with Eclipse.

One should increase the max memory used in the bin/idea.exe.vmoptions or bin/idea.sh.vmoptions file, edit the -Xmx line to about 350mb. IntelliJ can be downloaded at http://www.jetbrains.com/idea/download/ Use at least version 5.1.1. Note that this version can import Eclipse projects.

Requirements for building under Windows

  1. Make sure that you have a Sun JDK for Java 1.6.0 at or near the most recent patch level. (Some older patch levels are known to cause obscure problems with JNode builds.)
  2. Make sure that the pathname for the root directory your JNode tree contains no spaces. (Spaces in the pathname are likely to break the build.)
  3. Create a "bin" directory to holds some utilities; see below.
  4. Use the "System" control panel to add the "bin" directory to your windows %PATH%.
  5. Download the "nasm" assembler from http://nasm.sourceforge.net. (Make sure that you get the Win32 version not the DOS32 version!)
  6. Open the downloaded ZIP file, and copy the "nasm.exe" file to your "bin" directory. Then rename it to "nasmw.exe".

Now, can start a Windows command prompt, change directory to the JNode root, and build JNode as explained the next section.

Requirements for building under Linux

  1. Make sure that you have a Sun JDK for Java 1.6.0 at or near the most recent patch level. (Some older patch levels are known to cause obscure problems with JNode builds.)
  2. Make sure that the 'nasm' assembler is installed. If not, use "System>Add/Remove Software" (or your system's equivalent) to install it.

Building

Running "build.sh" or "build.bat" with no arguments to list the available build targets. Then choose the target that best matches your target environment / platform.

Alternatively, from within Eclipse, execute the "all" target of all/build.xml. Building in Eclipse is not advised for Eclipse version 2.x because of the amount of memory the build process takes. From Eclipse 3.x make sure to use Ant in an external process.

A JNode build will typically generate in the following files:

all/build/jnodedisk.pln A disk image for use in VMWare 3.0
all/build/x86/netboot/jnodesys.gz A bootable kernel image for use in Grub.
all/build/x86/netboot/full.jgz A initjar for use in Grub.

Some builds also generate an ISO image which you can burn to disk, and then use to boot into JNode from a CD / DVD drive.

IntelliJ Howto

This chapter explains how to use IntelliJ IDEA 4.5.4 with JNode. JetBrains Inc has donated a Open Source License to the dedicated developers working on JNode. The license can optained by contacting Martin.

New developers not yet on the JNode project can get a free 30-day trial license from JetBrains Inc.

Starting

JNode contains several modules within a single CVS module. To checkout and import these modules in IntelliJ, execute the following steps:

  1. Checkout the jnode module from CVS using IntelliJ's "File -> Check Out from CVS".

    Dedicated developer should use a Cvs root like ":ssh:developername@cvs.sourceforge.net:/cvsroot/jnode"

    Other should use Anonymous CVS Access and use Cvs root ":pserver:anonymous@cvs.sourceforge.net:/cvsroot/jnode"

  2. Open the project with "File -> Open project" and select the folder that was choosen as destination in the CVS check out. In the "jnode" folder select the "JNode.ipr" file.

The rest has been setup in the project and you should now be able to start.

Building

You can build JNode within IntelliJ by using the build.xml Ant file. In the right side of IntelliJ you find a "Ant Build" tab where the ant file is found. Run the "help" Target to get help on the build system.

Due to the memory requirements of the build process, it could be better to run the build from the commandline using build.bat (on windows) or build.sh (on unix).

Building on the Mac OSX / Intel platform

(These instructions were contributed by "jarrah".)

I've successfully built jnode on MacOS X from the trunk and the 2.6 sources. Here's what I needed to do:

  1. I'm using 10.5.2. I'm not sure if it works on 10.4.x.
  2. Download and install Java SE 6 from the ADC site. I used Developer Preview 9. Note that this only works on 64 bit compatible machines (MacBook Pro's with Core 2 Duo processors are OK). The link to the downloads page is: https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/105/wo/aC2LI...
  3. If you don't want to use Java SE 6 as your default Java (I don't), then edit build.sh and add /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/ before the java command.
  4. Download and build cdrtools (I used version 2.01.01) from http://cdrecord.berlios.de/private/cdrecord.html. I just installed the mkisofs executable in /usr/local/bin (which is in my path).
  5. Download and install yasm from http://www.tortall.net/projects/yasm/wiki/Download. I used version 0.6.2.
  6. Edit all/lib/jnode.xml and change the javac "memoryMaximumSize" attribute to "1024m".
  7. Edit core/src/openjdk/sun/sun/applet/AppletViewerPanel.java and comment out line 34 "import sun.tools.jar.*;"
  8. Run "sh build.sh cd-x86-lite".

You should end up with an ISO image called jnode-x86.iso in all/build/cdroms.

Cheers,

Greg

Using OSX and PowerPC for JNode development and testing

Using OSX and PPC for JNode development and testing

What we want is:
1. CVS tool
2. IDE for development
3. A way to build JNode
4. A way to boot JNode for testing

First of all we need to install the XCode tools from apple. Usually it is shipped with your OSX, look in /Applications/Installers/. If it is not there you, you can download it from apple’s site.

1. CVS tool
Well cvs is already in the OSX installation. There are some GUI tools to make the use of cvs easier. SmartCVS is a good one, which you can use it in your windows/PC computer, or linux etc.

2. IDE
Eclipse. Eye-wink

3. How to build JNode with a ppc machine (not FOR, WITH ppc)
Good for us, JNode build process is based on apache ant, which as a java tool runs everywhere. The only problem is the native assembly parts of JNode. For them JNode build process uses nasm and yasm.

So the only thing we need is to build them for ppc and use them. They will still make x86 binaries as they are written to do.

First of all we have to get the nasm and yasm sources. The first one is on
http://nasm.sourceforge.net
and the other is on
http://www.tortall.net/projects/yasm/

After that we unzip them and start the compile.

NASM
Open a terminal window and go inside the directory with the nasm sources

Run ./configure to create the Makefile for nasm

If everything is ok you now are ready to compile nasm. Just run ‘’make nasm‘’. Maybe there will be a problem if you try to compile all the nasm tools by running ‘’make’’ (I had), but you dont need them. Nasm is enought.

Now copy nasm in your path. /usr/bin is a good place.

YASM
The same as for nasm open a terminal window and go to the directory with yasm sources.

Run ‘’./configure’’

Run ‘’make’’

Now you can either copy yasm to /usr/bin or run ‘’make install’’ which will install the yasm tools under /usr/local/bin.

That’s all with nasm and yasm. You are ready to build JNode. You may have problems using the buildl.sh script, but you can always run the build command manually ‘’java -Xmx512M -Xms128M -jar core/lib/ant-launcher.jar -lib core/lib/ -lib /usr/lib/java/lib -f all/build.xml cd-x86’’

4. Booting JNode
Well there is only one way to do that. Emulation.

There is VirtualPC for OSX, which is pretty good and fast. To use it just create a new virtual PC and start it. When the virtual PC is started right click on the CD-Rom icon at the bottom of the window (hmm I know there is no right click on macs Sticking out tongue I assume you know to press ctrl+click). Now tell the VirtualPC to use the JNode iso image as cdrom drive and boot from it. There you are!

I think there is also qemu for ppc. I have not ever used it, so I don’t know how you can configure it.