D 2014-01-01T06:22:57.936 L SystemPreparation P f6e2b741c23622055baa3f0bc1956fe4cd474bac U zester W 2968
1) Create workspace (e.g.: /home/user/hydra).
2) Download the linux kernel image from here.
3) Download latest kernel # bzip2 d linux.x.xx.tar.bz2 # tar xvf linux.x.xx.xx.tar
4) Download Busybox from here # tar xvzf busyboxxxx.tar.gz
5) Now creating the kernel: # cd linuxxxx # make allnoconfig # make menuconfig
I used the following setting :
Executable file formats > Kernel support for ELF binaries > YES File systems > Second extended fs support > YES Device Drivers > ATA/ATAPI/MFM/RLL support > ATA/ATAPI/MFM/RLL support > YES Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support > YES Include IDE/ATA2 DISK support > YES Use multimode by default > YES
# make
6) Now Creating the filesystem # cd ../ # dd if=/dev/zero of=rootfs.img bs=1024k count=1 # mkfs.ext4 i 1024 F rootfs.img
7) Now Creating the Busybox # cd busyboxxxx # 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/i386uclibclinux/bin/i386uclibclinux” 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
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 busyboxxxx/_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
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
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 linuxxxx/arch/i386/boot/bzImage append “root=/dev/hda \ clock=pit” Z 7547a21ca073f39d36aa231afb63932e