LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] custom setup

[ILUG] custom setup

Kenn Humborg kenn at research.wombat.ie
Sun Oct 24 21:50:58 IST 1999


On Sun, Oct 24, 1999 at 08:11:39PM +0100, Vincent Murphy wrote:
>  i was thinking about building a linux system from scratch over the weekend,
> basically as a learning exercise.  all going well i would use the machine
> for day-to-day stuff, and maybe try the same thing with netbsd or something.
> i was hoping some of the gurus on the list could clarify some points for me.

First off, you're a bit mad, you realise that? :-)

>  from reading gcc docs, i reckon i am going to need to build gcc for the
> target machine on a host machine.  however, i'm not sure whether this will
> be sufficient.  will the toolchain (binutils and stuff) be built for the host
> machine or the target machine?  do i need to build a cross-compiler for the
> target system on the spare system, and then build a native compiler on the
> cross-compiler (on the spare system)?  this is getting complicated.

Are the host and target system the same architecture?  If so, then no
cross compiler is needed.  Just build binutils and gcc as normal.

You'll also need bash, sh-utils, fileutils, textutils, gnumake and glibc to build
stuff on the target, so you'd want to compile them up too.

For booting the target, you'll need init and a basic inittab that 
just runs (say) /etc/rc.d/rc.sysinit.  This should just fsck and mount
filesystems and drop you to a shell.  (Oops - you'll need to compile
up e2fsck as well...)

At this point, you've got a bunch of binaries on your host machine.
Best thing to do is probably to configure them to use a /usr/target-binaries
prefix, so that you know exactly what went where when you do the
make install.  (You _will_ have to do a make install for some of them
anyway.  Trying to decipher what the gcc build is going to install from
looking at the makefiles will drive you mad.  Trust me, I've just
built a GCC cross compiler and it's a scary piece of code.)

Now boot the target with some sort of boot/root floppy or rescue
disk, make the filesystems and copy over the binaries you've built.
(They'll have to be copied into the same locations (/usr/target-binaries)
as on the host, because things like GCC will have paths to certain
files and directories compiled in.  Eventually, you will rebuild them
on the target with a --prefix=/usr and re-install.)

This assumes that you can get networking working with the rescue
disk, otherwise you'll be swapping hard disks around...

Manually create the necessary stuff in /dev and /etc (probably just
/etc/inittab, /etc/mtab and /etc/fstab).

Now boot from your floppy and specify the target systems root filesystem
as the root.

Now copy over a kernel source tree and build.  Also get the LILO
sources and build.  At this stage, you'll be able to boot the target
without the boot floppy.

 From here on, it's just download, compile, install and configure.
If you want the system to be Filesystem Hierarchy Standard-complient,
you'll need to patch a lot of these other packages.

Note that this method isn't a completely from-source method because
we're using a pre-prepared boot floppy.  You could compile your own
boot floppy to get around that 'technicality'.

This is a hell of a lot of work, and not really worth it from a 
'learning experience' point of view.  You'd probably learn more
by building your own boot/rescue floppy set.

Of course, if the host and target are different architectures, (and
nobody's done the target architecture before) then the rules of the
game are completely different.  Your first step is to get a GCC
cross-compiler built (no trivial task).  Then port the kernel and 
build a minimal kernel.  Boot this kernel (somehow) and copy over
the essentials (previous compiled with the cross-compiler).

As it happens, I'm getting involved with the Linux/VAX project and
we're at just this stage.  The cross-compiler is about 60% done
and the kernel compiles (but doesn't link).  The VAX boot code
seems to work (in that it boots across the ethernet, enables VM, 
switches to C code, prints a couple of messages and halts).

We've got a long way to go yet.  Fun stuff!

Later,
Kenn






More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell