Not logged in

Artifact 2a9271e9072f83bae6bf2e1445e3747a76a1e53d:

Wiki page [SystemPreparation] by zester 2014-01-01 06:22:57.
D 2014-01-01T06:22:57.936
L SystemPreparation
P f6e2b741c23622055baa3f0bc1956fe4cd474bac
U zester
W 2968
<p>1) Create workspace (e.g.: /home/user/hydra).</p>

<p>2) Download the linux kernel image from here.</p>

<p>3) Download latest kernel 
# bzip2 ­d linux­.x.xx.tar.bz2
# tar ­xvf linux­.x.xx.xx.tar</p>

<p>4) Download Busybox from here
# tar ­xvzf busybox­xxx.tar.gz</p>




<p>5) Now creating the kernel:
# cd linux­xxx
# make allnoconfig
# make menuconfig</p>

<p>I used the following setting :</p>

<p>Executable file formats ­>  Kernel support for ELF binaries ­> YES </br>
File systems ­> Second extended fs support ­> YES </br>
Device Drivers ­> ATA/ATAPI/MFM/RLL support ­> ATA/ATAPI/MFM/RLL support > YES </br>
Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support ­> YES </br>
Include IDE/ATA­2 DISK support ­> YES </br>
Use multi­mode by default ­> YES
</p>

<p># make</p>

<p>6) Now Creating the filesystem
# cd ../
# dd if=/dev/zero of=rootfs.img bs=1024k count=1
# mkfs.ext4 i 1024 ­F rootfs.img</p>


<p>7) Now Creating the Busybox
# cd busybox­xxx
# make menuconfig
Busybox Settings ­> Build Options ­> Build BusyBox as a static binary ­> YES
Busybox Settings ­> Build Options ­> Build BusyBox with a Cross Compiler ­> YES
Busybox Settings ­> Build Options ­> Cross Compiler prefix:
“/usr/i386­uclibc­linux/bin/i386­uclibc­linux­”
Coreutils ­> cat chmod chown chroot cp cut date df du echo env false head ln ls mkdir
mknod mv printf pwd rm rmdir sleep sort stat stty sync tail test touch true tty uname
Console Utilities ­> setconsole
Editors ­> vi
Finding Utilities ­> grep
Init Utilities ­> init
Login/Password Management Utilities ­> addgroup delgroup adduser deluser getty login
passwd su
Linux System Utilities ­> more mount umount
Process Utilities ­> free kill
Shells ­> ash
Shells ­> Choose your default shell ­> ash
# make
# make install</p>

<p>8) Creating the node and the required support for the filesystem
# cd ..
# sudo mkdir /mnt/rootfs
# sudo mount ­o loop rootfs.img /mnt/rootfs
# rsync ­a busybox­xxx/_install/* /mnt/rootfs/
# sudo mkdir /mnt/rootfs/dev
# sudo mkdir /mnt/rootfs/etc
# sudo mkdir /mnt/rootfs/proc
# sudo mkdir /mnt/rootfs/sys
# sudo mkdir /mnt/rootfs/etc/init.d
# sudo mknod /mnt/rootfs/dev/console c 5 1
# sudo mknod /mnt/rootfs/dev/null c 1 3</p>

<p>Create file (/mnt/rootfs/etc/inittab)
# This is run first script
::sysinit:/etc/init.d/rcS
# Start an “askfirst” shell on the console
::askfirst:­/bin/sh
# Stuff to do when restarting the init process
::restart:/sbin/init
# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount ­a ­r</p>

Create file (/mnt/rootfs/etc/init.d/rcS)
#!/bin/sh
mount ­t proc none /proc
mount ­t sysfs none /sys
/bin/sh
# sudo chown ­R root.root /mnt/rootfs
# sync

Emulate kernel and filesystem
# qemu ­m 32 ­hda rootfs.img ­kernel linux­xxx/arch/i386/boot/bzImage ­append “root=/dev/hda \
clock=pit”
Z 7547a21ca073f39d36aa231afb63932e