Roy's Blog

A Hacker's musings on Code | Tech | Life

is what it took to emerge -e system. And no errors too :D OK, I had put python into package.provided as it just refuses to re-emerge for no good reason. If anyone has any insight into what is causing that then please let me know!

I rebooted and get kernel panics soon after loading rc and I thought eeek! wtf! :sick: So after chrooting of a livecd and swapping FreeBSD rc other with Gentoo baselayout I rebooted again .... and it worked! wtf? Why should this be?

Turned out it was openvpn crashing the kernel. Not sure why, so I'll need to investigate. Probably due to gcc dropping the __sparc64__ keyword, but I'm sure my patch is puka :/

But it's getting closer, soon Gentoo/FreeBSD/Sparc64 will be real and here for you to use :D

EDIT: Turns out kernel crashing is being caused by kldload loading ANY module. This means I can document this as a Known Issue and continue. Obviously it's something we need to resolve before making anything stable.

Continue reading...

Well, I hope it is :P

My SPARC has now got to the stage where all base system packages + a few extras I need (openvpn, dhcp, keychain, etc) have emerged successfully :) I've even managed to compile and install a custom kernel. The one thing I've not done yet is rebooted to check that the new kernel and boot loader actually work.

So all I have todo is emerge -e world twice to make 100% sure everything is peachy, rebuild the kernel again and reboot. If all goes well then I'll swap from FreeBSD rc over to Gentoo rc and reboot for the first time into a fully working Gentoo/FreeBSD on SPARC :jawdrop:

Not bad for a weeks work ;)

Actually, most of the work had already been done for me by the x86-fbsd team, all I had todo was patch binutils to brand elf binaries as FreeBSD when using FreeBSD on Sparc (FreeBSD patches elf.c as used by everything - we cannot do this, patch is here) and ensure that all __sparc64__ defines were changes to __sparc__ & & __arch64__. So it was mainly setting up the base profile and keywording ebuilds. Gentoo makes this very very easy 8)

Anyone wanting to look at the portage overlay for this can download it here. If either of the two links disappear it means they are now in the main portage tree, which means Mission Complete :D

Continue reading...

Builtin defines from gcc are useful - they give you some information about your arch. __i386__, __amd64__ and so on.

sparc is a little wierd - here's a quick list

  • __sparc__
  • __sparc64__
  • __sparc_v9__

Now, FreeBSD only supports Sparc64 and has lots of checks using #ifdef __sparc64__. At first glance, this looks OK and there appears to be nothing wrong with it. However, gcc likes to define __sparc64__ as a CPU type (as I understand it) and is no guarantee of 64-bit code. As such, if you use -mcpu=ultrasparc (which is valid) then it drops the __sparc64__ define as we're targeting a specific CPU model - namely the v9. A FreeBSD developer submitted a gcc patch to always define __sparc64__ but this was rejected, and looks like for good reasons too.

Of course, we can always say "dude, don't use -mcpu in your CFLAGS" and the issue magically goes away. Not so! In gcc-4, FreeBSD defaults to using -mcpu=ultrasparc which means that it never defines __sparc64__ which in turn means a vanilla gcc cannot compile FreeBSD code! Which explains why the default compiler on FreeBSD is gcc-3.4.6. Interesting we cannot use that version in Gentoo as our 3.4.6 never exports the __arch64__ define (or any other 64-bit defines) but still compiles 64-bit code. Weird. Anyway, our gcc-4.1.1 is fine for us.

So I'm busy writing patches to change __sparc64__ to __sparc__ as most of the time the code isn't 64-bit specific anyway. If it is, then it becomes __sparc__ && __arch64__ which works fine :) I dunno if upsteam will accept it, but I'll email it to them anyway when I'm done :P

Continue reading...

Rob Holland of Inverse Path (some may know him as tigger^ the ex Gentoo dev) had some free Sun SPARCs going, so I snagged a U5! Well, I've had it for some time now, but his Mum forgot to ship the keyboard. So it's been gathering dust in my room for months until yesterday they keyboard arrived. And it booted and stayed up! Yay! :DThe plan was to put Gentoo/Linux on it, mainly so I could fix Gentoo bug #104067. Since then I've put Gentoo/FreeBSD onto my laptop - mainly as the baselayout port was going nowhere fast. Now that the basic port is done (aside from fancy networking stuff) I've decided that I'm going to put Gentoo/FreeBSD on it :jawdrop:This is going to be interesting as there are no stages, no nothing. And it's a 333 Mz box with 256 meg of RAM - compiling is not its forte :O But that's the aim. Gentoo/FreeBSD on Sparc64. Lets see if it can be done :)So a big thanks to Rob at Inverse Path for the kind donation - it will be used well :D

Continue reading...