Build a simple bootable Linux based on the host

Source: Internet
Author: User

    1. Create a new system root directory/mnt/sysroot:

      #mkdir/mnt/sysroot


2. Add a piece of hard disk/DEV/SDB to format the target disk partition

Two:

On host:/DEV/SDB1,/DEV/SDB2

/DEV/SDB1 Mount to/mnt/sysroot/boot(target host root file system creation complete and then mount)

/DEV/SDB2 Mount to/mnt/sysroot

Create a root file system for the destination host

# mkdir-pv/mnt/sysroot/{etc/rc.d, USR, var, proc, Sys, Dev, lib, lib64, Bin, sbin, boot, SRV, mnt, media, home, Root

Then through the bincp.sh script to transplant Bash and other to the target host root file system:

The contents of the bincp.sh script are as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4B/AE/wKioL1QvygiyV3qjAAKQjB4ofRs683.jpg "title=" Qq20141004181919.png "alt=" Wkiol1qvygiyv3qjaakqjb4ofrs683.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/AB/wKiom1Qvyk6iNp2JAACEPSel4cg064.jpg "title=" 3.png " alt= "Wkiom1qvyk6inp2jaacepsel4cg064.jpg"/>


3. Install GRUB to target disk

# Grub-install--root-directory=/mnt/sysroot/dev/sdb



4. Copy kernel and INITRD files

# Cp/boot/vmlinuz-version/mnt/sysroot/boot/vmlinuz

# cp/boot/initramfs-version.img/mnt/sysroot/boot/initramfs.img



5. Provide configuration files for grub

# vim/mnt/boot/grub/grub.conf

Default=0

Timeout=5

Title mageedu Little Linux

Root (hd0,0)

Kernel/vmlinuz ro root=/dev/sda2 Quiet selinux=0 init=/bin/bash

Initrd/initramfs.img

Micro-Linux system production completed

This article from "Happy Heart every Day" blog, please be sure to keep this source http://as007012.blog.51cto.com/6215447/1560614

Build a simple bootable Linux based on the host

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.