Pages

Thursday 2 February 2012

Gentoo minimal CD on USB stick


mkdir /downloads
cd /downloads
wget http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/install-amd64-minimal-20120126.iso

emerge the necessary tools

emerge syslinux on gentoo

#aptitude install syslinux -> but i bypass this part

Note: you can also directly download syslinux and find the mbr.bin inside that bz2 files.

Find your usb flash drive

fdisk -l

Unmount if mounted

umount /dev/sdb1

Clear disk partition table and boot sector

dd if=/dev/zero of=/dev/sdb count=1024

Create a partition table with 512-byte sectors and a primary partition of type 83 (ext2) with fdisk and make it bootable

fdisk -b 512 /dev/sdb
n p 1 enter enter
t 83
a 1
p
w

Device     Boot      Start        End      Blocks   Id  System
/dev/sdb1   *           1        1009      500433   83  Linux

Formate the partition ext2 and tune it

mkfs.ext2 /dev/sdb1
tune2fs -i 0 /dev/sdb1

#aptitude install mbr syslinux mtools extlinux rsync

dn't use it, if u don'y know what will u doing.
install the mbr
mbr-install /dev/sdb

in other ways safe u can install grub or lilo
grub-install /dev/sdb

Note: the listing above is for Debian only. If you are using others, the listing above can be ignored.

download my mbr.bin from this.

extract wherever u cose
in my place : root@fa:/home/fa/syslinux#dd if=/home/fa/syslinux/mbr/mbr.bin of=/dev/sdb

mount the usb flash drive and disk image. If the device folder doesn't exist, please create them before conducting the following listing.

mount -t ext2 /dev/sdb1 /mnt/usb
mount -t iso9660 -o loop,user /downloads/install-x86-minimal-2008.0.iso /mnt/cdrom

install the system files

cd /mnt/usb/
cp -r /mnt/cdrom/* /mnt/usb/
mv isolinux extlinux
mv extlinux/isolinux.cfg extlinux/extlinux.conf
rm extlinux/isolinux.bin
rsync -av extlinux

install the bootloader

cd /mnt
extlinux -i /media/usbdisk/extlinux
umount /media/usbdisk

reboot, press F9 then insert gentoo-nofb
Note: Some older machines will not boot a usb formatted in ext2.
after that, go to this places