Partitioning
Use fdisk
to partition your hard disk.
# fdisk /dev/sda
Remember to set the root partition bootable!
For the rest of this instruction we assume the following partition layout.
/dev/sda1 (83 Linux) - for /,Creating File Systems
/dev/sda2 (82 Linux swap) - as swap
Below is how we get our / populated with ext3.
# mkfs.ext3 /dev/sda1
And the same for our swap partition.
# mkswap /dev/sda2
Getting Debootstrap
Debootstrap is a collection of scripts that we will use in the next step to set up a base system.
Make sure that binutils is installed on your system.
# wget debootstrap_1.0.7~gutsy1_all.deb
# dpkg -i debootstrap_1.0.7~gutsy1_all.deb
alpha, arm, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390,or sparc。
# debootstrap --arch i386 gutsy /ubuntu http://tw.archive.ubuntulinux.org/ubuntu
Installing the Base System
# cd /ubuntu
# cp -r * /media/disk/
The boot loader is most important, so do:
# grub-install --root-directory=/media/disk /dev/sda
please check /media/disk must have /boot/grub folder。
# cd /boot
# cp -r * /media/disk/boot
# vi menu.lst
# cp /etc/network/interfaces /media/disk/etc/network/interfaces
# cp /etc/resolv.conf /media/disk/etc/resolv.conf
# cp /etc/hostname /media/disk/etc/hostname
# cp /etc/apt/sources.list /media/disk/etc/apt/sources.list
Building External Linux Kernel Modules
# make menuconfig# make
# make install
# make modules
# make modulesa_install
Move new compile kernel and create link to disk
# mv config-2.6.22.9 /media/disk/boot/# mv System.map-2.6.22.9 /media/disk/boot/
# mv vmlinuz-2.6.22.9 /media/disk/boot/
# cp /etc/apt/sources.list /media/disk/etc/apt/sources.list
# cp -r /lib/modules/2.6.22.X /media/disk/lib/modules/2.6.22.X
# cp -r /lib/firmware/2.6.22.X /media/disk/lib/firmware/2.6.22.X
# cp initrd.img /media/disk/
# cd /media/disk/boot
# ln -s config-2.6.22.9 config
# ln -s System.map-2.6.22.9 System.map
# ln -s vmlinuz-2.6.22.9 vmlinuz
Enter the new environment
Before we chroot into the new environment we need to mount /proc and /dev
# mount -o bind /dev /media/disk/dev
# LANG= chroot /mnt/ubuntu /bin/bash
Update new packet list and installing packages for computer
# apt-get update# apt-get install busybox
# apt-get install vim
# apt-get install matchbox
# apt-get install locales
# apt-get install console-data
# dpkg-reconfigure locales
# dpkg-reconfigure console-data
沒有留言:
張貼留言