Getting Back to OSDev

It’s been a while, but recently I’ve got back in to OS Development. I tend to find I leave my old OS project alone for months (or years!) and then become inspired to go back to it. This time, it’s because I have some project ideas based on combining the Raspberry Pi with an Arduino Uno.

Anyway, each time I go back, it’s time to update the GCC Cross-Compiler (for basic instructions on how to create this, see the wiki over at OSDev.org) and a few other anciliary bits and pieces. Of course, because it’s been so long since I did any development, I’ve forgotten most of the little “gotchas” with the process.

Don’t Click on the Link Below!

The purpose of this post, therefore, is to act as an aide memoir for me and it may also possibly help someone else! I’m also putting a link up to my latest cross compiler. Now – before anyone interested in OSDev simply clicks on the link and gets going, allow me to persuade you not to click on the link!

The gzipped tar file contains the directory /cross and expects to be untarred in the /usr/local directory in cygwin. It contains cross-compilers for the i686-elf, x86_64 (yes – I know about the -m32 compiler switch…), AVR and Raspberry Pi on a 64 bit Windows Cygwin Host. This is the first reason for not downloading the gzipped file – it contains some specific cross-compilers that I use and this same subset is unlikely to be needed by anyone else, who will have their own targets in mind.

The next reason for not clicking the link, is that I think that anyone attempting OS Development should at least know their toolchain well enough to be able to build a cross-compiler. The link is provided more to be of assistance to someone who has done this before and doesn’t want to waste time doing it all over again.

The final reasons are that I provide absolutely no support for this download (an make no guarantees that it will do anything useful). It may harm your system and I do not provide any warranties against this. It may not even contain the latest version of the build tools…

Order of Installation

Now, the meat of this article follows, with the order in which I go about getting my OSDev environment back again.

Cygwin

Install Cygwin from the latest online installer. At a minimum, select the following packages (in addition to the automatically selected packages):

  • GCC4-Core, GCC4-g++, Nasm (I am in the process of removing this dependency and switching to gnu as).
  • Flex, Bison, Make
  • libmpc-devel, libmpfr-devel, libgmp-devel
  • Mkisofs
  • Git and openssh.

Self-Compiled Utilities

Next, it’s time to compile the utilities (including cross-compilers) that will be needed as a part of my build process. These are all downloaded as .tar.gz, unzipped to usr/src and then configured in a separate build directory.

  • GNU Binutils (targets: i[x]86-elf, x86_64-elf, arm-none-eabi, avr)
  • GNU GCC (same targets)
  • GRUB 2.00

 The Cross Compilers

…and here they are!

Behind the times – Getting started for the first time with the iPad

This week, I started using an iPad for the first time having been issued with with the instruction “this is for work, but have a play around with it and see what you think.”. It feels like I’m the last person to get started with tablet computing? Is should mention at this point that I’ve been brought up on PC’s, with MS operating systems (since DOS 5).

First impressions were good. I have an Android smartphone and UI responsiveness, use of the accelerometer for switching from portrait to landscape views, for example, we’re much the same – only bigger! The whole thing oozes build quality – this is a nice gadget to use.

Then I came to synchronise with my iTunes library ( I have an early-generation iPod). Wait a moment – the memory is how much? 16GB? Cheap USB flash drives have been available with that sort of capacity for years. I had a cheap pc with that sort of capacity back in 2000. My 5th generation iPod has 60GB of memory.

Now, bear in mind that this is not just my first experience of using an iPad – it’s my first time using any tablet computer. My first ports of call were therefore online PC/electronics retailers to see what else is out there. For the record, I found that I had been given an old iPad with 3G – not the new model. As of today, the 16GB iPad is listed on the Apple store for £429.00.

It seems that the memory in these things tends to be around 16-128GB. Once you get over 64GB, it seems that SSD’s are the norm. For the higher screen sizes (around the level of Apple’s offering), made by well known brands it does look like you pay similar prices at the 16GB level if you also want 3G? However, it seems that on the android tablets I’ve seen, you also get a USB and SD port, so you can at least extend the memory considerably and cheaply.

When I come to buy my own tablet PC, I think the only reason I would possibly buy an iPad is for compatibility with my iTunes library. Even then, I can already stream my music files to my Android smartphone using uPNP and I can only fit a tiny fraction of my iTunes purchases on to the iPad. To add insult to injury, my iTunes collection is held on a NAS which works well on my windows PC as iTunes reads it through a mapped drive. The iPad will not let me do this and iTunes compatibility keeps breaking with the NAS every time Apple update iTunes. A truly frustrating situation. If I want to stream music to the iPad using the official iTunes apps and using the official iTunes protocol with music and movies I have legitimately bough from the iTunes store, I would have to purchase more hardware or leave my PC on all the time, when I have a perfectly good NAS to do the job. No thanks.

I think I’m going to see what sort of tablets Windows 8 is released on and consider the options. It’s not often that you can say buying MS reduces vendor lock-in!

Working with SQL Server 2010 in VC# 2010

[Edit: so much for my first attempt at posting something useful! When I first wrote this post, I had resigned myself to the fact that C# in VS2012 Express was only going to be available for Windows 8. Now VS Express for Desktop is available for Windows 7 and both the Database Explorer and graphical EDMX creator solve the problem outlined below! For anyone with the problem of not being able to connect to SQL Server 2012 in VS2010 Express, my advice would now be to upgrade to VS2012.]

I came across a problem (and solution!) that intrigued me recently in Visual Studio 2010. I thought I’d share it in case anyone else found the same thing.

I have recently got back in to C# programming – there’s now a good reason to because I need a particular piece of bespoke software for my business. I’m using Windows 7 with Visual Studio 2010 Express Edition – I’m a hobby programmer after all! I have also recently acquired SQL Server 2012 Express Edition. My intention is to create an Entity Framework-based class library backend, initially with a WPF/C# frontend (although one of the reasons for keeping the two items separate from an early stage, is that I would ultimately like to access the database through Silverlight too).

Here’s the situation: Install Visual C# 2010 + SP1 – fine. Install SQL Server 2012 – fine. Create a class library project and add and “ADO.NET Entity Data Model”, generated from a database…but which data connection should I choose? I appear to have only 2 options, namely “Microsoft SQL Server Compact 3.5″ and “Microsoft SQL Server Database File”. Hmm. Not what I wanted, but OK – we can probably get away with the second option. It’s always possible to change the connection string to “properly” use SQL Server later:

Change Data Source Dialog Box

Visual C# 2010 Change Data Source Dialog Box

We’re then asked to select the database file to use. We can either point to an existing database file or create a new one. In my case, I had created a basic outline database in SQL Server Management Studio. Problem is, when we select this file (located using the database path location initially specified when installing SQL Server), we get an error that the file is in use and cannot proceed. I’ve tried fiddling with file and directory permissions, but to no avail.

OK – next port of call was to create a new database and edit it using the Database Explorer. Annoying, but surely workable. It turns out that this assumption was wrong.

Visual C# 2010 Entity Data Model Wizard Dialog Box

The Visual C# 2010 Entity Data Model Wizard Dialog Box – all seems well so far…

Server Not Supported Error

…but then!

So this got me thinking – I was really quite keen on using SQL Server 2012 and didn’t want to go through all the grief of either downgrading to SQL Server 2008 (which, by the way, you still cannot connect to in the “standard” way in VC# 2010), or having two alternative installations alongside one another on my PC.

A while ago now (when VS2010 Express was first released), I had a play with Visual Web Developer 2010 – although I’ve never deployed any ASP.NET in the real world (having been brought up on cheap hosting packages using PHP and MySQL – I’m not saying there’s anything wrong with PHP/MySQL just because the hosts are cheaper!). I was sure at that time I had set up a Vista PC running SQL Server 2008, IIS and Visual Web Developer – using a “standard” SQL server connection. Turns out, I had.

Visual Web Developer Change Data Source Dialog

And there it is!

This is very good news. The class library I am creating is going to be designed to work as a data provider for possibly multiple front-ends and a requirement is that it work with ASP.NET. The solution is therefore:

  1. Take the Class Library created in VC# 2010 and open in in Visual Web Developer 2010.
  2. Create the Entity Data Model (edmx) file using “Microsoft SQL Server” as the data provider.
  3. Save the project and reopen your solution in VC# 2010.

Simple! You now have a solution with a “standard” SQL Server connection (i.e. the connection string will be the same on a development and deployment machine, rather than using file access for one scenario and server access for the other). The caveat is that you still can’t use database explorer from within VC# 2010 (or Visual Web Developer for that matter – unless you want to switch to SQL Server 2008). This is not a big problem for me – I have the database open in SQL Server Management Studio and the solution open in VC# 2010 – excellent if you have a dual monitor setup! Once the edmx file has been set up initially in Visual Web Developer, you can add, update and alter Entity Objects as you wish from within VC# 2010.

Entity Model in Design View

Entity Model in Design View – note the “Add”, “Refresh” and “Delete” tabs are all functional despite the fact that VC# 2010 earlier complained about the SQL Server version.

Current Projects

I’ve started to get some content together for the site and promise I’ll get something more substantial up here over the next couple of days.

Since I last posted anything on my web site, there have been a lot of changes in both career and home life. This means that programming has been put on the back burner. Out of interest, I had a look at my OS code again recently and got the old kernel booting from GRUB2 – I’m in danger of getting the programming bug again! It doesn’t help that I now have my Raspberry Pi and will be very tempted to try getting the kernel up on that, in addition to continuing with my AMD64 version.

As far as high level programming goes, I have an optometry practice management system based on C#/SQL Server that I’d like to get a bit further with. This relates more to my day job and is therefore the most likely programming project to bring in a bit of money one day :)

I enjoy teaching and would love to get some more tutorials up here as well. If only there were more hours in the day!