Use isolinux to create liveUSB

Source: Internet
Author: User
Abstract: During linux startup, control needs to be transferred from biso to the boot program and then to the system kernel. Among them, there are many boot programs, including lilo, grub, etc. This article describes isolinux. By learning the isolinux boot method, we will be able to learn how to create & ldquo; from

Abstract: During linux startup, control needs to be transferred from biso to the boot program and then to the system kernel. Among them, there are many boot programs, including lilo, grub, etc. This article describes isolinux. By learning the isolinux boot method, we will be able to learn how to create a "boot system from USB ". What should you do if you want to customize your linux release? We can all find the answer when learning isolinux. Finally, other articles in this article will teach you how to customize your system.

1. what is isolinux?

Before the operating system starts, the boot program needs to load the operating system to the memory. isolinux is a kind of boot program, which has the same effect as lilo and grub. The entire system loading and initialization process is roughly as follows:

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.

2. Construction of isolinux

Boot program isolinux. bin: It is used to read isolinux. cfg and decide the boot kernel file based on the configuration options.

Configuration file isolinux. cfg: The format is as follows:

label linux  kernel vmlinuz  append initrd=initrd26.gz ramdisk_size=1000000 vga=791
The configuration options in the cfg file are roughly as follows:

Required:

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.

Optional

System startup Kernel: initrd

Strictly speaking, initrd is not part of the boot program, but part of the kernel program. For more information about initrd, see here: http://blog.csdn.net/trochiluses/article/details/17583991.

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 want to add content, simply copy the corresponding files in linux. 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.

3. create an instance

Our goal is to use isolinux to boot the system. Therefore, we need to create an iso image file, modify the configurations in initrd, and create a boot configuration file.

3.1) create the startup interface

Character mode startup interface

The character mode startup interface uses 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 items.

default menu.c32prompt 0menu title My Distro Installertimeout 600f1 help.txtf2 version.txtlabel blsmenu label Normal installmenu defaultkernel vmlinuzappend initrd=cpio.gz rdinit=/initlabel badmenu label Bad hardware installkernel vmlinuzappend initrd=cpio2.gz badhardware rdinit=/init

As you can see, the main adjustment here is to adjust the default option and change it to the 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.

Use vesamenu to create a startup interface

The method for starting vesamenu is basically the same as that for using menu. 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.

Use the bootlogo file to create a startup interface

To use the bootlogo to create the startup interface, first create 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.

3.2) ISO file creation

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/isolinux.bin -c boot/isolinux/boot.cat /-no-emul-boot -boot-load-size 4 -boot-info-table /for-iso-dir/

The final parameter is the Directory of the specified CD. the file with the-c parameter is automatically generated. do not worry too much. the 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. 4. Summary

To customize your own release or liveUSB, you often need to change the initrd. The change method is as follows:

In the kernel after 2.6, the initrd format is gzip. in this case, you need to decompress it into a common file system image.

gzip -d initrd.img.gz
Note: To decompress gzip, the file suffix must be identified as gz. Therefore, you must first add a suffix to the file.

After decompression, we can run the file command to check whether the file format of initrd. img has changed.

After decompression, this is a cpio file. open the archive file:

cpio -idv initrd.img < initrd.img
After the startup, execute the init script. In fact, if you want to customize your own release, you just need to create this initrd and related iso files. The production process is the opposite of the above process.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.