$apt-get install gcc
$apt-get install linux-headers-`uname -r`
$apt-get install make
$apt-get install build-essential
$apt-get install libncurses5-dev
=====================================================
2. download Xubuntu installer initrd
=====================================================
3. Decompression initrd
$gunzip initrd.img.gz
$mkdir test
$cd test
$cpio -i -d < ../init.img
=====================================================
4. Revised init content shows as follows
$cd /
$vim ./init
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How to program script for fdisk command?
> fdisk_command.sh
#!/bin/sh -e
fdisk /dev/sda < /script.sh
> script.sh
#!/bin/sh -e
n
p
1
t
83
w
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Disable kernel's message
$echo "0 0 0 0" > /proc/sys/kernel/printfk
// Remove message of fdisk command to trash
$./fdisk_command.sh > /dev/null
// Modify fdisk source code to remove title message
=====================================================
5. download Xubuntu installer busybox 1.1.3
6. Build BusyBox kernel
$make allnoconfig
$make menuconfig
Busybox Setting
Build Options
[*]Build BusyBox as a static binary (no shared libs)
[*]Build with Large File Support (for accessing files > 2GB)
Installation Options -> [*]Don't use /usr
Miscellaneous Utilities -> Don't choose
Shells -> default (ash)
Others setting can be chosen by oneself
Save Configuration to an Alternate file
$make
$make install
$cp -ar ./_install/* /home/gary/myinitrd/test/
$cd /home/gary/myinitrd/test
=====================================================
Compression
$find .| cpio -o -H newc > ../myinitrd.img
$cd ..
$ gzip -9 myinitrd.img