Start-up process for Mini Linux systems

Source: Internet
Author: User
Tags parent directory root directory linux

For a clearer understanding, try to simply do a Grub+kernel startup Mini Linux System

Experimental environment: Vmware9 rhel5.8

First step: Add the disk you want

Turn off the virtual machine rhel5.8, and then Setting-->add .... (Pro, these really don't want to write ...)

Add a Virtual disk (SCSI.VMDK); Note that this disk is recommended for use with SCSI

(Create IDE disk, and then finally mini system boot when kernel panic ...) Maybe it's a small bug in VMware, it's not exactly clear.

Step Two: Create partitions

Use existing system rhel5.8 for disk partition (because the system has two disk sda,sdb, so this is SDA, your own see HA)

SDC1 Store grub, kernel and other files---> this partition is only 50M size, enough to use

SDC2 root partition, the size of the custom, the author here only gave 1G

Step three: Create grub for SDB1 and copy or create the required files for startup (Pro, it's important oh ...)

1. mke2fs-j/dev/sdc1;mke2fs-j/DEV/SDC2 Format two partitions

2. mount/dev/sdc1/media/boot/;mount/dev/sdc2/media/sysroot/mount to local directory (directory created by itself)

3. Grub-install--ROOT-DIRECTORY=/MEDIA/DEV/SDC

Use this command to create a boot sector and grub required files for SDC (personal understanding)

Note that the--root-directory=/media is the parent directory of the Mount point/media/boot, and the understanding can refer to the system/boot directory is also located in the/root directory,

The contents of the/boot depend on whether you mount the boot partition ... (Er, pro, this is a bit of a detour, do not knock, slowly come on good),/DEV/SDC is the target disk, remember that the disk is not partition.

4. vim/media/boot/grub.conf

Default=0 which system to start by default: 0 is the first one, 1 is the second one

Timeout=30 Timeout time

Splashimage= (hd0,0)/grub/splash.xpm.gz

Pictures loaded at startup: This grub-install will not be created, you can copy the system original (the author is)

You can also do it yourself (640x480 pixel, 14-bit color, GIMP edit save for xpm format, gzip-9 compression, copy to grub directory, specify name here)

Hiddenmenu whether to hide the options below show ... Do not want to hide, this line can be deleted ...

Title Hello mos! Title

Root (hd0,0) if the system has only one disk, that is (hd0,0), and if you are unsure, you can use Find (hd0,0)/Locate the disk you need

KERNEL/VMLINUZ-2.6.18-308.EL5 Specifies the boot kernel, this file needs to be replicated, and the root here refers to the boot partition. (I went around here again.) Well, for the system, the/boot parent directory is the root/, and for the boot partition, the ultimate root is the boot partition.

Initrd/initrd.gz This file also need to replicate, the trouble is, you need to extract the modifications and then package the copy over ... Original file name General initrd-2.6.18-308.el5.img version number to be consistent with kernel version number

This file (grub.conf) is saved and exited

Step Fourth: Copy or modify and copy the required files for the new hard drive boot

1. cp/boot/grub/splash.xpm.gz/media/boot/grub/;cp/boot/vmlinuz-2.6.18-308.el5/media/boot/copy these two, boot picture + kernel

2. MKDIR-PV/OPT/INITRD to build a directory, dedicated toss initrd-2.6.18-308.el5.img

2.1 Modify and use: Initrd-2.6.18-308.el5.img First introduction:

This file is stored as: Cpio archive, gzip compressed. This is a larger, more-driven kernel than the kernel, running in a read-only fashion

It is perfectly understandable that it is a mini system that is responsible for making the system go over to the real kernel (VMLINUZ-2.6.18-308.EL5) and so on (personal understanding)

2.2 cp/boot/initrd-2.6.18-308.el5.img/opt/initrd.gz copied and renamed, because you want to use gzip decompression, so as not to cause unnecessary trouble

2.3 gzip-d/opt/initrd.gz

2.4 CD/OPT/INITRD

2.5 Cpio-id <. /INITRD to unpack the files

2.6 Vim/opt/initrd/init

Find Mkrootdev-t Ext3-o defaults,ro/dev/sda2 this trip

Modify its content to match the second partition of your new disk, and modify it to align with your sdc2 (this is my third disk sdc2, but in the new system, still sda2)

2.6 Find/opt/initrd/|cpio-o--quiet-h newc|gzip-9 >/media/boot/initrd.gz After the modification is completed, archive, compress, and drop to the new disk under the first partition

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.