Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Mon Jan 23, 2012 6:03 pm

I would like to be able to build my own version of linux to run on the Pi so it is tailor made just for the projects i want to do. A quick search led me to Linux From Scratch and reading up it looks just the job for what i want.

I don't have much linux experience but i do understand the file system, can use the cli comfortably and can install from source code although i have to admit i sometimes find it a tad tricky. I suspect it won't be easy but i am willing to persevere.

I just wondered if anyone had any comments on the suitability and difficulty of the job and if there is any better way of doing it.

zomzilla
Posts: 42
Joined: Wed Nov 16, 2011 3:04 pm

Re: Making a unique OS

Mon Jan 23, 2012 6:22 pm

well i thought the same so am trying it under a default virtualbox

my only problem is that the instructions are sometimes unclear; and sometimes seem to contradict.

but so far its been pretty easy

stormy1
Posts: 60
Joined: Fri Jan 06, 2012 3:44 am

Re: Making a unique OS

Mon Jan 23, 2012 9:46 pm

I was going to do this, I find way to much junk in most distributions.

Then I found out puppy will be ported to PI.

So maybe I wont have to do so.

From what I understand of puppy it installs the bare min needed to run then you add only what you want.

roelfrenkema
Posts: 105
Joined: Sat Jan 07, 2012 5:17 pm

Re: Making a unique OS

Mon Jan 23, 2012 9:56 pm

I will try to recreate crunchbang linux.

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Mon Jan 23, 2012 10:00 pm

Puppy is one of my favourite distros but it isn't exactly what i'm looking for so either i make do with something that isn't exactly right or i make something that is right. I have the latest Ubuntu installed at  the moment so will try Linux From Scratch and try to build exactly what i want. If it works then i can build an Arm version later or if i fail then Puppy is a fall back.

SergeantFTC
Posts: 52
Joined: Mon Aug 29, 2011 7:46 pm
Location: Delaware, USA

Re: Making a unique OS

Mon Jan 23, 2012 10:14 pm

stormy1 said:


From what I understand of puppy it installs the bare min needed to run then you add only what you want.


Puppy still installs some unnecessary stuff. If you want the absolute bare minimum, go with Arch Linux, which will be officially supported on the pi. It doesn't even include a GUI by default.

Asmodeus
Posts: 29
Joined: Mon Aug 01, 2011 7:44 am

Re: Making a unique OS

Tue Jan 24, 2012 10:40 am

I am sure that the final version of the official "RaspberryLinux"-distribution will have a working packet manager. You will be able to uninstall unwanted packages.

http://en.wikipedia.org/wiki/P.....ent_system

Partholan
Posts: 8
Joined: Fri Dec 09, 2011 3:10 pm

Re: Making a unique OS

Tue Jan 24, 2012 10:53 am

You might want to try Gentoo which also compiles everything (like you would do in Linux From Scratch) but comes with a package manager (Portage) to support you in compiling and installing packages.

Using specific flags (USE flags) you can even optimize packages to use or drop various features, e.g. you can select by USE flag which SQL database is to be used by a specific package.

Also, you can optimize the compiler by setting compiler options in a file called make.conf, so everything will be compiled supporting the features of your hardware.

For everything there is a generic way to compile things (i.e. the result would run on many machines) and the possibility to optimize it for one architecture, thus dropping the compatibility with other machines. But since you'd only compile for one specific system (the Raspberry Pi) you don't need to keep compatibility with other systems.

By default, Gentoo installs a very basic setup which doesn't include any GUI or X at all.

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Wed Jan 25, 2012 5:45 pm

Both Arch and Gentoo look easier to handle than Linux From Scratch. There doesn't seem to be that much difference to the installation procedure or the final result so will probably try both and pick the one i prefer. Thanks for the advice on that.

I know i should probably start a new post for this but whilst i'm here.... There are a multitude of window managers available but does anyone have any advice on the best lightweight version. KDE and Gnome are very pretty but i don't need that, just something functional. I am quite keen on (used to) the JWM that Puppy uses but is there anything better/smaller out there.

SergeantFTC
Posts: 52
Joined: Mon Aug 29, 2011 7:46 pm
Location: Delaware, USA

Re: Making a unique OS

Wed Jan 25, 2012 6:10 pm

IMHO, the primary difference between Gentoo and Arch is that Arch uses mostly precompiled packages while Gentoo makes you compile them yourself. Arch is also significantly easier to install.

If you want just a window manager, use fluxbox. If you want something more fully featured, but still very lightweight, definitely check out LXDE.

Marlon
Posts: 4
Joined: Mon Jan 09, 2012 3:21 pm

Re: Making a unique OS

Wed Jan 25, 2012 7:10 pm

Really lightweight WM are Openbox, Fluxbox or dwm. LXDE (which uses Openbox) is a desktop environment like KDE or Gnome.

zomzilla
Posts: 42
Joined: Wed Nov 16, 2011 3:04 pm

Re: Making a unique OS

Thu Jan 26, 2012 10:00 pm

Hiro said:


Both Arch and Gentoo look easier to handle than Linux From Scratch


well thats what i thought; but installation from source is what i want so no Arch; and having installed Gentoo and Funtoo a few times and played with LFS i think LFS is actually not hard at all! in theory a beginner could follow the instructions and make their own OS (though imho its not a distro until it has its own package manager)

laszlo
Posts: 25
Joined: Thu Jan 26, 2012 6:03 pm

Re: Making a unique OS

Fri Jan 27, 2012 8:01 pm

I have been building my own linux systems (I wouldn't call them distributions) from source since before LFS.  I have actually read through and tried the LFS process a few times, and they did a really good job.  I would highly recommend it to anyone who's interested like I am  Targeting an x86/amd64 VM is probably the easiest way to go.  Embedded SoC systems have their own special way of booting, and while it's actually much simpler than x86 BIOS, ACPI, EFI and all that, there is a lot more information for the 'common' case of installing LILO or GRUB on x86 BIOS computers.

The basic steps to getting a booted system are something like..

Build toolchain for your target - this means binutils for the most part

Build compiler for your target - either native or cross, this is gcc's C compiler, and maybe C++

Build linux with your toolchain/compiler - it may take a few iterations to figure out what drivers you need to compile into it to access your root filesystem device, or eventually build an initramfs image..

Build your c lib, usually glibc or maybe uclibc these days.

Build a static bash binary

Make a filesystem, put your bash binary in /bin

Do whatever your platform needs in order to load your kernel image and tell it the root filesystem.. for example with GRUB, you could just dump the kernel image on your new filesystem too, say at /linux, then you would do something like:

root (hd0,0)

kernel /linux root=/dev/sda1 init=/bin/bash

boot

And if it works, the kernel will detect your controller and hard drive, or whatever it is, and mount the root filesystem which just contains your /bin/bash, then it will execute it.

This is not going to really function or do much, but it's your bare minimum.

Using something like busybox as the next step would give you a ton of simple commands all in one program.. and you could use an init program that will set up your virtual terminals and spawn login shells on them.. and install some kind of desktop environment abomination after that

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Sun Jan 29, 2012 7:11 pm

Thought i'd let you know where i'm at with this. Had a bit of a mare with LFS as the script on their site which checks for the correct versions of required packages flagged up a problem with libc.so.6 which it claimed wasn't there. It took an awful lot of searching to find out that it had simply been moved and wouldn't be a problem (apparently no link needed) so i'll have to try that again later.

Arch was a lot better, i did have a problem with Grub which is odd as i haven't before, guess i possibly did something stupid but it's all sorted now. The biggest problem with a beginner trying something like this is knowing which packages you are going to need. I figure a large pot of coffee and google will eventually sort it out. I simply picked the obvious stuff this time and apart from the Grub problem i soon had a nice new CLI sat in front of me. A bit of experimentation with Pacman and i soon had the LXDE desktop there as well. I could recommend Arch to any relatively inexperienced user looking to custom build their own linux, just read the guide on the home page and it's quite easy.

Next step is to have another go at the LFS and try Gentoo and definitely try to build a smaller Arch by learning more about which packages i do and don't need.

Thanks for all the help.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Making a unique OS

Mon Jan 30, 2012 4:33 pm

Have you looked at:

http://buildroot.uclibc.org/

Should take a lot of hassle out of home spinning your own OS ....

David.

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Tue Jan 31, 2012 5:42 pm

I didn't know there were so many ways to roll your own. I intend to try them all at some time but sticking with Arch for now as i already have it working.

The next part of the problem is of course to make an Arm version and install it to an SD card but i'm not really sure how to do this. I don't have an Arm processor here so can i use a virtual machine to create an Arm installation and then copy that to the SD card? I have found a thread here that deals with getting an image on to a card but i just don't know if virtual machine can create a suitable image.

Has anybody done this yet? I have the Ubuntu that Ukscone did running in a VM but that is an OVA file and i do not think that can be transferred to a card, can VM produce a file that can be used in this way?

Thanks for the help, Hiro.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Making a unique OS

Wed Feb 01, 2012 11:19 am

For a start you'll need to compile a cross compiler, and probably a c library uclib or glibc. Its a bit of a hassle, which is why things like buildroot are helpful - cos they do all that for you.

Also look into what boot loader you'll be using - arm machines usually don't go the grub direction, and they'll be some hassle there.

Odds are by the time you got all this working, you be able to buy a RPi - so won't need an emulator ...

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Wed Feb 01, 2012 4:34 pm

Will having a Pi make things any easier though, i thought it could only boot off the SD card. Is this wrong, will it be able to boot to a cd plugged into the usb port and install as per usual? If not i still have the problem of getting my os built onto the card.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Making a unique OS

Wed Feb 01, 2012 5:52 pm

That bits easy – unplug the SD card from the pi – plug it into your development machine – the write the file system.

That kinda why you'll need to understand the pi boot process – I guess it will have something in flash/rom by default – and you'll need to fit in with that. E.g. if its uboot, then the first few stages of booting will need to look as uboot expects ….

It would be unusual if the pi tries to boot direct from the sd - e.g. on power up does the arm come up in a way that can read the sd? Anyway if it does just try and execute straight from the start of the sd - then you'll need an arm boot loader that can be bootstrapped from the MBR, am not sure if I know a solution that does that ....

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Thu Feb 02, 2012 8:06 pm

summers said:


That bits easy – unplug the SD card from the pi – plug it into your development machine – the write the file system.

The trouble is my development machine isn't an Arm processor. As you say i probably can't do a lot at the moment until a few people start playing with the boot process after the release date. I was just interested in whether it was going to be possible to create an Arm file system on a x86 machine using VM and then transfer or if it could be installed directly to the card in the Pi either from a cd or from files dropped onto the card first.


nullstring
Posts: 178
Joined: Sun Oct 02, 2011 3:05 pm

Re: Making a unique OS

Thu Feb 02, 2012 8:45 pm

As others have said, rather than going through the hassle of building your own Linux (Completely tedious and unnecessary), I would recommend using Arch Linux.

Arch Linux does have "extra stuff", but nothing thats bloating, and nothing that I think you'll find you don't want. It's really the best solution for this. I've used it before without any complaints what-so-ever.

I would very much recommend giving it a try before doing something as drastic as LFS.

There are is a big reason that you Don't want to do Linux From Scratch on an RPI.


Compiling your own packages will take a -very- long time on Linux from Scratch. 


I would recon compiling things like X, QT, etc will take over a day each. (Using a USB HDD will help decrease this, but it will still be significant).

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: Making a unique OS

Thu Feb 02, 2012 9:55 pm

Already done the Arch linux thing last weekend on my x86 machine and was surprised how easy it was. I intend to keep using it but will also be trying as many other roll your own type systems as i have time for just to see what they are like.

I was just curious whether or not i'd be able to build my own Arm based Arch  package ready for when i get a Pi without having an Arm processor to hand.

There  seems to be a bit of a lack of information about this sort of thing at the moment but i'm sure that'll change soon after release date.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Making a unique OS

Fri Feb 03, 2012 9:32 am

Hiro said:




The trouble is my development machine isn't an Arm processor. As you say i probably can't do a lot at the moment until a few people start playing with the boot process after the release date. I was just interested in whether it was going to be possible to create an Arm file system on a x86 machine using VM and then transfer or if it could be installed directly to the card in the Pi either from a cd or from files dropped onto the card first.



Thats why I suggested a cross compiler / tool chain. A cross compiler is a compiler that runs on one architecture -  but produces code that runs on a different architecture. So on say an x86 machine. you compile all the executables needed on an arm based system – then build up the file system for the arm on the x86, then just copy it to the flash.

You'll actually find this a far easier direction to go in – its a lot easier developing code on a desk top machine,  than say on a RPi

Try looking at this link:

http://www.denx.de/wiki/DULG/ELDK

And with the boot process - my guess is you won't be far wrong to assume it will be uboot like ....

rpt
Posts: 51
Joined: Tue Jan 31, 2012 3:09 pm

Re: Making a unique OS

Fri Feb 03, 2012 10:13 am

summers said:


That bits easy – unplug the SD card from the pi – plug it into your development machine – the write the file system.

That kinda why you"ll need to understand the pi boot process – I guess it will have something in flash/rom by default – and you"ll need to fit in with that. E.g. if its uboot, then the first few stages of booting will need to look as uboot expects ….

It would be unusual if the pi tries to boot direct from the sd - e.g. on power up does the arm come up in a way that can read the sd? Anyway if it does just try and execute straight from the start of the sd - then you'll need an arm boot loader that can be bootstrapped from the MBR, am not sure if I know a solution that does that ....


Actually the Pi does boot direct from the SD card. At boot time the GPU runs before the ARM processor. I don't know the details but I imagine it configures the necessary hardware on the SoC, such as the DRAM controller, and then it finds the kernel on the SD card and copies it into RAM. It then allows the ARM processor to start. As far as the ARM is concerned, its code is already in RAM when it boots.

All you have to do is ensure the first partition on the SD card is formatted  FAT32 and contains the kernel. After this you can put the rootfs wherever you want, either on the SD card or on an external USB hard drive.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Making a unique OS

Fri Feb 03, 2012 10:20 am

rpt said:


Actually the Pi does boot direct from the SD card. At boot time the GPU runs before the ARM processor. I don't know the details but I imagine it configures the necessary hardware on the SoC, such as the DRAM controller, and then it finds the kernel on the SD card and copies it into RAM. It then allows the ARM processor to start. As far as the ARM is concerned, its code is already in RAM when it boots.
All you have to do is ensure the first partition on the SD card is formatted  FAT32 and contains the kernel. After this you can put the rootfs wherever you want, either on the SD card or on an external USB hard drive.


Am confused – how does the arm know how to find the kernel on the SD? It must have a bootloader somewhere. I'd be very surprised if the arm on power up has configured the hardware in a way that it can just execute instructions from the SD?

I guess you are saying that there is a ROM somewhere (which we can't modify), and that it will boot kernels from the SD? If so whats the spec on what the ROM code expects?

Edit: Reading the FAQ, yes it says the GPU does the first stage of the bootloader. That sounds seriously wierd. Does beg the question of what bootloader does the GPU use ....

Oh yes ELDK above, this is a better link:

http://www.denx.de/wiki/ELDK-5/WebHome

as its more arm related …

Return to “Other projects”