Introduction to GRUB for Linux

Source: Internet
Author: User

Features of Grub

1. Provide a choice of kernel or System 2 to boot. Provides an interactive interface. Enter GRUB after pressing the E key to enter the interface of grub, can already line Linux system Operation Basic Choice. 3. Password-based protection: Enable kernel image, pass parameter 12341234

Interface format for GRUB

Title: The kernel of the operating system or the header of the system root: Sets the kernel file partition of grub and kernel: Define the kernel file to use, and then attach the parameters passed to the kernel INITRD: Specify the additional drivers provided by the kernel and other functions 12341234

Grub configuration file format

default=0       //Specifies the default boot kernel or boot timeout=5        //waits for the user to select the kernel length, the default unit is seconds splashimage= (hd0,0)/grub/splash.xpm.gz      // Images used at startup hiddenmenu      //hidden menu title centos  (2.6.32-696.6.3.el6.x86_64)     //System kernel name         root  (hd0,0)                    //the partition where the kernel resides         kernel /vmlinuz-2.6.32-696.6.3.el6.x86_64 ro  Root=uuid=9b571efa-58dc-46c5-add3-871cf8abf3c0 rd_no_luks  keyboardtype=pc keytable=us  rd_no_md crashkernel=auto lang=zh_cn. utf-8 rd_no_lvm rd_no_dm rhgb quiet         / /kernel file and pass parameter         initrd /initramfs-2.6 to the kernel.32-696.6.3.el6.x86_64.img1234567812345678 

make a simple kernel
Create another kernel on a system that already has a kernel

 1.  Create the boot and sysroot directories under/mnt     [[email protected] mnt]# mkdir  boot sysroot 2.  partition two partitions on the disk and format them separately for/mnt/boot and/mnt/sysroot     [[email  protected] mnt]# fdisk /dev/sda    WARNING: DOS-compatible  Mode is deprecated. it ' s strongly recommended to switch off the  mode  (command  ' C ')  and change display units to sectors  ( command  ' u ') .    command  (m for help): N    first  cylinder  (4361-7833, default 4361): using default value 4361     last cylinder, +cylinders or +size{k,m,g} (4361-7833, default  7833): +500m    command  (m for help): n     first cylinder  (4426-7833, default 4426):  using default value 4426    last  cylinder, +cylinders or +size{K,M,G}  (4426-7833, default 7833):  +500m     Command  (M FOR HELP): w    [[email protected]  MNT] #kpartx  -af /dev/sda    [[email protected] mnt] #partx  - A /DEV/SDA    [[EMAIL PROTECTED] MNT] #mke2fs  -t eth4 /dev/ SDA7    [[EMAIL PROTECTED] MNT] #mke2fs  -T eth4 /dev/sda8     [[EMAIL PROTECTED] MNT] #mount  /dev/sda7 /mnt/boot     [[EMAIL PROTECTED] MNT] #mount  /dev/sda8 /mnt/sysroot 3.  production grub     [[EMAIL PROTECTED] MNT] #grub-install --root-directory=/mnt   /dev/ sda7    //Note that the disk file here is mounted under/mnt/boot disk  4.  copy kernel file     [[email protected] boot]#  cp /boot/vmlinuz-2.6.32-696.6.3.el6.x86_64 /boot/initramfs-2.6.32-696.6.3.el6.x86_64.img  /mnt/boot/ 5.  Create the root file system of the target machine     [[EMAIL PROTECTED] ]# MKDIR -PV  /mnt/sysroot/{dev,boot,root,home,etc/rc.d,urs,lib,bin,sbin,lib64,mnt,proc,var,medis,sys} 6.  Copy bash and root file system     [[email protected] ] #cp  /bin/bash /mnt/sysroot/bin  7.  Configure GRUB Profiles      vim /mnt/boot/grub/grub.conf      default=0       timeout=5        title         root (hd0,0)       kernel /vmlinuz ro root=/dev/sda1 selinux=0 init=/bin/bash      initramfs /initramfs


This article is from the "Lnsanellinux" blog, make sure to keep this source http://lnsane784.blog.51cto.com/1226518/1948699

Introduction to GRUB for Linux

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.