Guide to Hacking the OSD: The First Compile

From The Neuros Technology Wiki

Jump to: navigation, search
Previous Chapter Table of Contents Next Chapter

Contents

The First Compile

Obtaining the Source Code

The source for everything running on the OSD is in the SVN repository in the Neuros SVN repository.

Occasional tarballs are available here which may download faster. 

Please note: the OSD source repository was previously hosted at svn.neurostechnology.com instead of svn2.neurostechnology.com. If you still have code that reference these repositories you will need to either download the new ones or relocate your old ones. You can check if you reference the old URL by using the "svn info" command on your current repositories. Please consult this mailing list post for instructions on how to migrate your repositories.

Below are the instructions if you want to start fresh.

  • You can checkout the repositories that you need by checking out only one of them, and then letting an helper script do the rest. Here's the procedure (you will need to have the SVN client installed):
  svn checkout https://svn2.neurostechnology.com/neuros-bsp/trunk neuros-bsp
  cd neuros-bsp
  ./build-helper.sh checkout

This will take quite some time as it need to fetch a lot of data. Be patient.

With the above, you have just downloaded "trunk", which is the part of the repository where we keep the cutting edge and unstable version of the code, the place where all new commits end up. Trunk is sometimes broken, and it won't build or won't work sometimes.

You can always switch all your code to any of the tags or branches (which may be more stable), whenever you want, with this command, issued from inside neuros-osd:

 for d in $(ls) ; do svn switch https://svn2.neurostechnology.com/$d/NAME $d ; done

You should replace NAME with either "trunk" or "tags/TAGNAME" with TAGNAME being any of the tag names in the page linked above (e.g. "OSD_VER_3.18-0.13_060919"). You can move to any tag or to trunk or any other way around whenever you want.

Finally, only if you're on trunk and want to update to get new commits that happened since last time, you can issue this command, from inside neuros-osd:

 for d in $(ls) ; do svn up $d ; done

Note that this makes sense only for trunk, because tags are snapshots and thus are fixed in time and don't ever receive updates.

So, choose the set of sources that makes more sense to you, and go on with the rest of the guide, always keeping the neuros-osd directory as the root for everything, unless otherwise specified.


Building the Code

Make sure you have dialog, ncurses, and mkcramfs installed. Arizona also requires debian's zlib1g-dev package.

Also note that these scripts require /bin/sh to be bash or linked to bash (this is not the default in some distros, for example newer Ubuntu, so please check).

Now all you need do to to build everything from scratch is:

 cd neuros-bsp
 ./build-helper.sh all

You will be asked for your sudo password (if you have not already entered it recently), and then you will need to answer "Yes" when asked if you want to run configuration for the Linux kernel on a blue screen.

The then be prepared to watch a good time while the build rolls.


Link here to help when the build fails, forums/IRC channel

Installing the Kernel for NetBooting

This one is fairly easy.

cd /srv/tftp
mkdir -p images
ln -s /PATH/TO/neuros-osd/neuros-bsp/images/uImage images/uImage

That's it. Make sure that the uImage file is readable by your TFTP server.

Alternatively, you can also copy instead of just symlink the uImage. This is easier to bypass permissions and other issues, but on the other hand needs to be done again at each rebuild of the kernel. I suggest putting it in a script togheter with the step below.

cp /PATH/TO/neuros-osd/neuros-bsp/images/uImage /srv/tftp/images

Installing the Root Filesystem for NetBooting

Installing the rootfs for the first time involves some messing about since you need to copy the /dev nodes that require some special permissions or nothing will work and your OSD boot will fail. We use tar for that. We need to do this everytime we change our rootfs, that is everytime we rebuild anything.

 cd /PATH/TO/neuros-osd/neuros-bsp/rootfs/fs
 tar --exclude '*/.svn*' -czf ../rootfs.tgz .
 mv ../rootfs.tgz /srv/neuros-osd-rootfs
 cd /srv/neuros-osd-rootfs
 sudo tar xzf rootfs.tgz
 rm rootfs.tgz
 

Notice that you need to be root when you extract the rootfs archive, so that created permissions are correct. If you don't like sudo, become root there in your preferred way.

(Note: Optional step, you can skip this) You can do the thing above everytime (possibly in a script so you don't wear off your fingers). Or you can use a little trick with rsync if you want to update only the changed files, once the /dev nodes are in place the first time.

 rsync --verbose --archive --delete --exclude "/dev/" --exclude "/mnt/" --exclude ".svn/" /PATH/TO/neuros-osd/neuros-bsp/rootfs/fs /srv/neuros/fs

This works for me, but your experience may differ, but it's optional anyway.

Previous Chapter Table of Contents Next Chapter
Personal tools