Make your own Linux system and boot CD

Source: Internet
Author: User

1, STEP1 preparation Isolinux.bin and working directory

Add a subdirectory to the directory where you are preparing the ISO, such as isolinux/, and then put the isolinux.cfg and a boot media isolinux.bin that isolinux the same as all discs. Isolinux.bin can do so, visit Syslinux's official website (below), download the syslinux-4.04.tar.bz2 file it provides, and the current version is 4.04.

Http://www.syslinux.org/wiki/index.php/ISOLINUX#What_is_ISOLINUX.3F

Of course also put the corresponding kernel, initrd and so on, the directory structure is as follows:

Listing 1. CD_ROOT directory Structure


|---isolinux

| |---isolinux.bin

| |---isolinux.cfg

|---kernel (OS kernel)

|---initrd (file system)

|---Readme


Kernel is the operating system kernel that needs booting, the Linux kernel is selected here, and the kernel acquisition can be obtained by compiling the appropriate Linux kernel version, this is the version 3.10.61. The kernel can be tailored according to its own needs, not in this statement. Remember, when compiling, be sure to choose x86_64 Architecture, because this article is based on x86_64 architecture mirroring, if you do not know how to choose the CPU architecture, you can refer to the following wording:

# make arch=x86_64 menuconfig//When you start the Menuconfig configuration menu, you need to install it in advance ncurses

# make

The kernel image Bzimage is generated in Arch/x86/boot after the compilation is complete. Copy it to Cd_root (the root of the ISO), but you can also create the relevant folder to hold the kernel and file system, except for the path problem when configuring Isolinux.cfg (refer to the next section).

In addition to kernel mirroring, a file system is required. This section uses BusyBox to create a file system and generate RAMDisk image file ramdisk.img. The way to make a RAMDisk file is shown in the section: FileSystem, where a section specifically explains how to make a root file system.

2.2 STEP2 Configuration Isolinux.cfg


Prompt 1

Timeout 100

Default Mybiosiso

Label Mybiosiso

Kernel/bzimage

Append initrd=/ramdisk.img load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=60000 rw root=/dev/ram

"Append initrd=/ramdisk.img inst.stage2=hd:label=centos\x207\x20x86_64 # # # (centos\x207\x20x86_64 is the ID of the mirror, where \x20 represents Space. It is defined in the Mkisofs command Plus-V "CentOS 7 x86_64") "

Configure Isolinux.cfg

Only a simple configuration is done here. Note that the file system here is ramdisk.img, after the author experiments, found that the use of compressed image ramdisk.img.gz, there will be no errors found in the file, when the author renamed the compressed file to ramdisk.gz, the problem is resolved. So, here I recommend using append initrd=/ramdisk.gz load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=60000 rw root=/dev/ram. This will make the boot disk very small. The size of the ISO image I made this time is 5 m, and of course you can do it even smaller if you need to.

In addition, Isolinux can also be used to add content such as menus. You can refer to the documentation in Syslinux for more information, and I will tell you about the menu in the next section.

2.3 Step3 making BIOS platform bootable CD

# mkisofs-o Output.iso-b isolinux/isolinux.bin-c \

isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info-table Cd_root


To make a BIOS platform bootable CD command

When making an ISO, use the-b parameter to specify the path where the Isolinux.bin is located, and the-c parameter of the file (Boot.cat) is generated automatically, without concern, and the rest of the parameters are fixed. The paths here are relative to the root directory of the disc, and are not related to the working directory when the disc was made.

650) this.width=650; "src=" Http://my.csdn.net/uploads/201207/31/1343723263_9926.JPG "style=" border:none; "/>

When you are finished, the ISO image disc file is generated in the current directory (also specified), and the file name is Output.iso.

Next, you can verify in the virtual machine whether the resulting ISO file can start Linux. First install VMware6.0, and then create a new virtual machine, memory and hard disk do not have to choose a large, to know that our kernel is very small, choose 256M of memory, hard disk 1G (can be smaller, because such operations do not need the hard disk, as long as the memory is enough), after completion, The resulting ISO is loaded into the virtual machine's CD-ROM drive, and the virtual machine is started, and similar information will appear successfully.


650) this.width=650; "src=" Http://my.csdn.net/uploads/201207/31/1343723315_9341.JPG "style=" border:none; "/>

650) this.width=650; "src=" Http://my.csdn.net/uploads/201207/31/1343723358_9564.JPG "style=" border:none; "/>

650) this.width=650; "src=" Http://my.csdn.net/uploads/201207/31/1343723408_7307.JPG "style=" border:none; "/>

It is important to note that our root filesystem exists in memory, so you will see that it takes some time to load ramdisk1.img. Here, simply comb the entire startup process. First, the BIOS completes the first stage of booting, the virtual machine boots from the CD-ROM, isolinux loads the kernel image into the virtual machine memory, then loads the file system (RAMDisk) into memory, gives execution permissions to the Linux kernel, and the kernel starts and loads the file system.

At this point, you can use the virtual machine to verify your own modified kernel and root files. Of course, this is just a very brief and coarse boot disc, for learning the Linux kernel and file system is quite beneficial, you don't have to worry about this will damage your computer's current state, because all things are in memory.

In the following chapters, I will describe the richer startup features and how to boot our Linux system from the hard drive.


This article is from the "Instant over" blog, please be sure to keep this source http://misliang.blog.51cto.com/6973084/1610670

Make your own Linux system and boot CD

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.