Experience Summary: customized ubuntu live cd requires a pilot process for any operating system to run on any hardware platform, that is, initialize the software environment, place the kernel from the storage medium into the memory, and start running. Of course, for some simple software and hardware systems, this process may be simple, but it is slightly more complicated for PCs.
The PC boot program carries the BIOS and kernel initialization code. Although there is no trace after the boot only once, it is still very important. All the boot programs are doing something similar: they can be started by BIOS in a special location in the storage media, or they are executable files of a system, it can be explicitly or implicitly started by the user in the system (host system); understand the location of the necessary startup files to be started, including the system kernel, ramdisk, etc, and read them out and load them into the memory. Construct the environment and run the kernel of the operating system, and exit the historical stage. Historically, LILO and Grub are the most famous boot programs for Linux. As a general boot program, they are widely used, but for some special occasions, for example, the boot program can use a limited amount of removable storage media (in general, including optical disks, floppy disks, and u disks), which are somewhat too heavy, this leads to SYSLINUX and ISOLINUX. SYSLINUX/ISOLINUX is a lightweight boot program dedicated to guiding removable media, because such a media is usually not fixed for only one kind of hardware. We mainly introduce the following ISOLINUX boot installer. ISOLINUX is actually a simple Linux system. Its structure is very simple. This file mainly includes the following aspects: the boot program isolinux. bin is a boot file of ISOLINUX. It is equivalent to the grub program in Linux. When the system is started, the isolinux program is first loaded. bin to start the system, when the isolinux. after bin is started, it will be based on the following configuration file isolinux. cfg to select different startup options to start the system. This file is a binary file, which can be obtained when compiling isolinux. It is not described too much here. Configure the boot item file isolinux. the cfg file is the configuration file started by ISOLINUX. With this file, the boot program isolinux. bin will start the system only when booting according to the configuration content of the configuration file, and select different boot items. There are many configuration items in isolinux. cfg. You can choose to add configuration items related to yourself as needed. However, the following configuration items are mandatory: default linux specifies that the label is the default of the linux Startup option, of course, it can also be other. Label linux kernel vmlinuz append initrdw.initrd26.gz ramdisk_size = 1000000 vga = 791 this is a startup description. The preceding label is the boot option during Linux Startup. It is equivalent to the title in grub. Kernel specifies the kernel at startup. Initrd = Specify the initrd file and ramdisk_size = specify the maximum size of the initrd. There may be many other kernel parameters. In fact, all the Linux kernel startup parameters can be added here. Prompt = 1 This is to say, prompt the user to enter the selection, directly press enter is the default option. Of course, if it is set to 0, the user is not prompted to enter the selection. There is no time limit for timeout = 0. You can also specify a certain period of time to automatically enter the default option. This time is 10 times the number of seconds. For example, if you want to wait for 30 seconds, enter timeout = 300 here. These are mandatory during system boot. Of course, some options are unavailable. The following options are optional. Display xxx.txt specifies a file name that will be displayed at startup. This file can even contain an RLE-encoded graphic file, that is what we saw when we installed the CD and started it. However, this field is not very important and we skipped it. Gfxboot bootlogo specifies the graphic interface at startup. This option is usually added to Linux system installation disks, but in some special requirements, the graphical interface is not required, but the character mode is required. How to create the image startup mode and the character startup mode depends on the selected kernel options and settings. This will be detailed below. Include ××× this is to introduce a completed configuration option file to the configuration file. During execution, all content in the introduced file will be added to this file to form a zero-time configuration file to start the system. There are so many basic configuration items. Of course there are many other configuration items that you need to refer to the relevant authoritative manual to learn about. After the system starts the kernel program, the ISOLINUX system calls a startup kernel to start a simple Linux system. In fact, both installation and restoration of the Linux system require a simple Linux system to call the corresponding program. The Linux kernel program used in the boot disk is exactly the same as the general Linux system kernel. Here, the special one is its initrd image file. This file is actually a minimal Linux system. It contains shell, mount, and fdisk, and mainly contains various common basic drivers in Linux. Especially hard drive and keyboard and mouse drive. Without these drivers, the system will not be able to find the hard disk, and the system will not start properly. The initrd file is special. It must contain not only the above files, but also some files related to the function of the CD. For example, if you want to install it, you must also have a simple formatting command. In addition, in order to make the iso file used by most PCs, various drivers must be included. The initrd file is well created. You can use the initrd file when Linux is started as a basic file and modify it in it. If you need to add content, simply copy the corresponding files in the linux system. In addition, the startup script under initrd is the init file. We recommend that you modify the file as needed. The file is a script written in shell. When the Linux system is started, the script will be called after the kernel is loaded. Therefore, you can add any scripts to the script that need to be started. You can even use this script as a basic script for self-installation and repair. However, this is not recommended because it is difficult to debug. We recommend that you place the system startup-related content here for execution, and put your script in the executable directory [bin/sbin, etc.], and call the script in the init script for execution. The preceding steps are used as an example to illustrate how to understand ISOLinux. The next job is to adjust initrd and content under the iso directory based on your skills and needs. Here I will mainly introduce the creation of several startup interfaces: character-mode startup interface, using the menu. c32 kernel as the startup kernel. The menu. c32 file is provided by the ISOLINUX package. It can be compiled and generated directly from the ISOLINUX package. With this file, we only need to modify the isolinux. cfg file. For specific modifications, refer to the following configuration item default menu. c32 prompt 0 menu title My Distro Installer timeout 600 f1 help.txt f2 version.txt label empty menu label Normal install menu default kernel vmlinuz append initrd1_cpio.gz rdinit =/init label bad menu label Bad hardware install kernel vmlinuz append initrdw.cpio2.gz badhardware rdinit =/init, the main adjustment here is to adjust the default option and change it to menu. c32 file. Because this is specified, the menu. c32 boot is used by default. Next we will add several menu options. The main purpose of these options is to set the startup options. We recommend that you set the name to a name that is easy to recognize. In addition, note that the menu default option is specified and is started from that option by default. When using menu, you can also add the following parameters to set the width/height ratio of the Option window: menu width 80/* Set WIDTH */menu margin 10 menu rows 12/* set number of ROWS */menu tabmsgrow 18 MENU items linerow 12 menu endrow 24 menu timeoutrow 20 can be added, you can also choose not to add. You can add both or none of them. Easy to set. This type of startup is in character mode and is drawn out in ascii code. The advantage is that the memory usage is small and the startup speed is fast. The disadvantage is that the interface is monotonous. 2. Use vesamenu to create the startup interface and use vesamenu to start the interface. The difference is that the default boot item is different. In this mode, the default boot item must be set to vesamenu. In addition, the default BACKGROUND color of vesamenu is gray. To change the BACKGROUND image, add menu background os102.png to change the BACKGROUND image. However, it is worth noting that the background image cannot be made too beautifully, because it cannot be loaded normally if it is too gorgeous. This method is easy to start and allows you to create a graphic startup interface. The disadvantage is that you cannot create a beautiful startup interface. 3. You can use the bootlogo file to create a boot interface by creating a beautiful bootlogo file. This file is a binary file that adds images. For details about how to create the file, you need some help from the experts. The younger brother is not very clear. In addition, you only need to add the gfxboot bootlogo option to the isolinux. cfg file. The configuration file of the ISO image file has been written and is now in the substantive stage. Add a sub-directory, such as boot/isolinux/, to the directory where you want to create ISO, and then put it in isolinux. cfg and a boot medium isolinux provided by isolinux, which is the same for all CDs. bin, of course, we also need to put the corresponding kernel, initrd, and other files we need to call during the boot, and then use the-B parameter when making the iso to specify the isolinux. binfile startup: mkisofs-o output. iso \-B boot/isolinux. bin-c boot/isolinux/boot. cat \-no-emul-boot-load-size 4-boot-info-table \ for-iso-dir/the final parameter is the directory of the specified CD, -The file of the c parameter is automatically generated, so don't worry too much. Other parameters are fixed. In fact, some people often use isolinux/instead of boot/isolinux/. This is a convention, and you can use your own. The path here is relative to the root of the CD, but it has nothing to do with the working directory when the CD is created. So far, the entire system startup and production process has been completed. With this knowledge, you can design a simple boot CD. As for the CD function, you need to modify and adjust it as needed!