In this meeting we will finish the Gentoo install. Then we will look at how the Gentoo package management, Portage, works. Then we will look at how a Linux system initializes. Ok, you should now have finished compiling the gentoo kernel. The final steps are to copy the kernel to the /boot directory and install some utilities. Here is a list of the remaining steps before a reboot. The file fstab lists the partitions you want mounted at boot. If you only have a single partion it is not needed, but still a good idea to create. This file sets the host name for your computer. The net file specifies the configuration you need for your network. This can be somewhat confusing, but an example file is available atOnce you have created this file you need to tell the system to execute it a boot time. Execute the commands:rc-update add net.eth0 default to tell the init process to execute the net.eth0 at startup. Create the root password. Run the command:passwd and create a password for the root user. Edit the file:This sets the keyboard configuration. Normally you can leave it US. Or if you like you can modify a keymap from/lib/kbd/keymaps.i386/qwerty to suit your tastes and then set this as your keyboard map. Edit the file:/etc/conf.d/clock for your timezone. Install a System Logger. A system logger is useful to keep a running log of what is happening on your computer. I encourage you to install syslog-ng using the following commands. rc-update add syslog-ng defaultInstall a Cron Daemon for scheduled tasks. A cron daemon will execute commands from a schedule, which is useful to keep you system running well. I encourage you to install Cron using the following commands. rc-update add vixie-cron defaultIf you are using DHCP remember to install it. If you home network supports DHCP you willl need to install the program with the command:Install a Boot loader. You can use Lilo if you want, but I prefer grub. The documentation from gentoo is pretty good here, so follow that. One issue to keep in mind, you need to know if your system uses /dev/sda, or /dev/hda so you can tell grub where to find the MBR. But I am sure you already knew that. Now that the install is finished we need to reboot the system. If everything is set up correctly, we can now do a reboot and run from the hard disk Well if all went OK, you now have a minimal Gentoo linux system. Yes it is command line only. Yes it has only the root user. Yes only the kernel is tuned to run on your computer. But it works. As far as what come next, I am going to give you some pointers on where to go for more information, but exploring what you have now is part of the fun of Linux. Now before you think you are on your own configuring a gentoo system let me point to MUCH more information. The best place to start is the Gentoo Documentation Resources. This gives detailed information on how to bring up a number of different scenarios for using Gentoo. As I have pointed out before, Linux is as place to explore ideas. So here is a neat trick you can use to create your very own sandbox with a minimal of fuss. I am going to make some assumptions first so lets state those to avoid confusion. Your hard drive is /dev/sda. You have only used about 1/4 of it up to now. I will assume you have a 200 Gig hard disk, if yours is a different size scale thing accordingly. The sizes don’t have to be exact, you can adjust them once you understand how this works. You have created 4 partitions, 3 primary and 1 extended. The extended partition covers 3/4 of the hard disk. Partiton /dev/sda1 is your boot partition of 1 gig in size. You have installed grub in this partition, and you are using the MBR to call grub. Partition /dev/sda2 is the root of your minimalist gentoo system. Everything but the boot partition is installed there. It’s size is say 30 - 40 gig. Partition /dev/sda3 is your swap partition of about 4 gig in size. Partition /dev/sda4 is an extended partition containing the rest of the hard disk. It should have enough room for 2 to 4 copies of /dev/sda2. You know what the part of the grub.conf setup is used to boot your partition. It should be a section which starts with title and includes an option like root=/dev/sda2 or real_root=/dev/sda2. The Gentoo system is installed correctly and runs correctly. You know how to use Fdisk to partition the hard disk. You know how to use an editor like nano or vi. You know how to make a file system on a new partition. Finally you are not afraid of using the commandline. But I suppose if you were afraid of the command line you would not be in the Advanced section. ;-)What we are going to do is create clones of our minimal system in other partitions and play there. Before we start this we need to first make a copy of our existing system. So here are the steps. Unmount the boot partiton from the root using the command:umount -v /boot. This will prevent us from backing up the boot partiton. Create a tar archive of the whole system using the command:tar czvf /boot/system-backup.tar.gz /. This will create an archive copy of the system in the /boot folder. Once the archive is created lets move it to a safe place with the command:mv /boot/system-backup.tar.gz /root. This will prevent us from deleting the file when we remount the /boot partition. Remount the /boot partition by using the mount command:mount -a. Which is the mount all command in Linux. Now you have all the tools you need start creating your own sandbox partitions. So lets lay out the steps to make it happen. Use fdisk to create a new partiton to locate your sandbox partition in. By default it should be an ext2 type. Format the partition using themke2fs command. It is now ready to use. Reboot the computer so the new partition table is included in the OS. Mount the new partition in a temporary location like/mnt/sandbox. You might need to create the folder first. Assuming your new partition is /dev/sda5 and it is an ext2 partition, the command is:mount -v -t ext2 /dev/sda2 /mnt/sandbox. CD into the new partition and unarchive the backup we created before using the command:tar xzvf /root//system-backup.tar.gz. You now have a duplicate of your original system. Edit the grub menu at/boot/grub/grub.conf. You need to copy the line for booting your current partition to create a second copy of the lines. Next you need to change the Title so you know which is the sandbox and the root location from /dev/sda2 to /dev/sda5. You should make sure the timeout is long enough for you to change from the default to the new entry. Next you need to make two changes to the copy of the OS. Edit the file:/mnt/sandbox/etc/fstab to change the root partition number from /dev/sda2 to /dev/sda5. You probably should comment out the mounting of the /boot partition. This will prevent you from clobbering your setup with an update, but we will deal with that later. Reboot your system, and select the newly created partition. You now have a sandbox partition to play in. Any changes will not affect your minimal system. If you want to go back to the pristine state, you can boot back to the original location and reformat the partition to use it again. This trick works because you can use the same files for all the partitions unless you update your kernel. I will leave it to you to figure out how to update the kernel on one partition and not another. There are virtual machines out there which can make things simpler, but they require much more configuration and resources. Before we start discussing how to use tools to compile code in Linux, I thought we would do a quick review of how to create a simple program in C using Linux. Here is a web page I found that has a good initial explainationAn beginners guide to compiling programs under Linux is something I found on the Web. This is a local copy, which I have shortened. The original source is Here . Now that we have an understanding of the C code file, we will move on to the Make file. Make is a tool to allow you to compile multiple source files and then link them together to make a more complex executable. Here is a reasonable tutorial I came across. Now that we have had a look at some of the low level tools, lets see what happens when we compile some of our own programs. For this I am going to refer back to a previous talk I gave to this group. Compile your own programs from SourceThe build process used by gentoo is of special interest to us if we are going to learn how to build a Linux from Scratch. But before we start to examine portage, we should do a review of how software is converted from source code to executable code in Linux. We are going to take a look at the gentoo handbook at this point to review Portage. This is the scripting mechanism used to automate the process of building software in Gentoo. We will look at some of the scripts and files used. The idea is not to gain a complete understanding of how this scripting tools works, but just to get some ideas of what can be done. Next we are going to have a look at how init scripts work in Linux. The init process is how your computer boots, and starts the processes needed for a running system. One good good explaination can be had from the Wikipedia article Linux startup process. A second good source is from a site which contains many worth while articles, although they are a little old, YoLinux.com: Linux Init Process / PC Boot Procedure. And lastly in this set is an article from IBM’s Developer Works titled: Inside the Linux boot process. Written by John F. MooreLast Revised: Mon Jan 16 15:37:36 EST 2017