Installation
This document explains how to create and install a GNU/Linux distribution using the GNU/Linux System Architect Toolkit (a.k.a. Architect). This document is geared toward someone who wants to not only build a system, but to learn something about its operation along the way. As a result, this is not the most direct approach to building.
The bare necessities
It doesn't take much to bring a GNU/Linux system up to an interactive shell prompt. All that is required is a boot loader, a kernel, a statically-linked shell and a device node for the system console.
Build
- Boot into the development system.
- Create a filesystem on a spare partition and mount it.
- Use the 'mkfhs' script to create a basic directory structure on the target filesystem.
- Build bash-static and install to the target filesystem.
- Create a console device in target filesystem's /dev directory.
- Build a Linux kernel and install it to target filesystem's /boot directory.
- Configure the development system's boot loader to be able to boot from the target partition.
Explore
Boot into the target system and take a moment to explore. Notice that the only working commands are shell built-ins like 'cd' and 'pwd'. 'ls' does not work since it has not been installed yet, but you can still list files using 'echo *'.
Reboot with CTRL+ALT+DEL or power off.
Disaster drill one
Sometimes bad things happen to nice filesystems and it's a good idea to be prepared when disaster strikes. This section simulates repair procedures on a system with a corrupted root filesystem.
Build
- Boot into the development system.
- Build the e2fsprogs-static package and install it on the target filesystem.
- Create a device node for the target partition in the target filesystem's /dev directory. (eg. mknod -m660 hdb1 b 3 65)
Explore
- Boot into the target system passing kernel parameter 'init=/bin/sh' via boot loader.
- Run e2fsck on root the device (eg. /sbin/e2fsck -fp /dev/hdb1).
- Reboot with CTRL+ALT+DEL or power off.
Basic functionality
In this section statically-linked versions of tar and gzip are used to install additional programs onto the system. In order to do this, the system is brought up with a writable root filesystem by passing an option to the kernel via the boot loader.
Build
- Boot into the development system.
- Build gzip-static and tar-static and install them to the target filesystem.
- Build the coreutils, util-linux and glibc packages and copy them to target filesystem's /var/packages directory.
- Copy MAKEDEV to target filesystem's /dev directory.
Install
- Boot into the target system passing rw kernel flag via boot loader.
- Extract coreutils, util-linux and glibc packages into / of target system (eg. cd / ; tar -zxf /var/packages/pkg-name.i586.tar.gz).
- Mount /proc (eg. mount -t proc proc /proc).
- Use MAKEDEV to create basic, ide-disk & virtual-terminal sets on the target system's /dev directory.
Explore
- Try out familiar commands from coreutils like 'cat', 'ls', 'date' and so on.
- Remount / as read-only (eg. mount -n -o remount,ro /dev/hdb1 /).
- Reboot with CTRL+ALT+DEL or power off.
Disaster drill two
Build
- Boot into the development system.
- Build the sysvinit-static package and install it on the target filesystem.
- Copy the /etc/passwd and /etc/group templates to the target filesystem.
Explore
- Boot into the target system.
- Enter 's' when prompted for a runlevel.
- Press ENTER to go into maintenance mode.
- Run e2fsck on root the device (eg. e2fsck -fp /dev/hdb1).
- Enter the command 'stty sane'.
- Explore the system.
- Reset the system or power off.
Declaring independence
This section adds a C compiler and other development tools to the system. This allows additional programs to be built directly on the system without relying on another distribution to do the work.
Build
- Boot into the development system.
- Build remaining packages from the stage1 list and copy them to the target filesystem's /var/packages directory.
- Download the Linux kernel source code (eg. linux-2.4.34.tar.gz) to the target filesystem's /usr/src directory.
- Reboot.
Install
- Boot into the target system using one of the methods described in the disaster drills above.
- Remount / as read-write (eg. mount -n -o remount,rw /dev/hdb1 /).
- Extract all new packages from /var/packages into /.
- Extract the Linux kernel source code into /usr/src.
- Create a symbolic link named /usr/src/linux that points to /usr/src/linux-{version} (eg. cd /usr/src ; ln -s linux-2.4.34 linux).
- Create a symbolic link named /bin/bash that points to /bin/bash-static.
Explore
- Test gcc with a simple hello world program.
- Set the PATH variable to a normal value (eg. PATH=/sbin:/bin:/usr/sbin:/usr/bin ; export PATH).
- Build a Linux kernel (eg. make oldconfig; make dep; make clean; make bzImage).
- Remount / as read-only.
- Reboot or power off.
Cutting the lifeline
There is enough functionality in the system that all ties with the development distribution can be cut. This section involves copying the Architect toolkit to the target system for complete independence.
Copy the files
- Boot into the development system.
- Copy system scripts into target system's /etc/init.d/
- Copy config files to appropriate directories on target system.
- Copy package source code to the target filesystem's /usr/src directory.
- Copy package blueprints and documentation to the target filesystem's /root directory.
Finish the system
- Boot into the target system using one of the disaster drill methods.
- Build and install stage2 packages.
- Build and install stage3 packages.
- Create a symbolic link named /bin/bash that points to /usr/bin/bash.
- Customize the configuration files in /etc
- Restart the system.