Install the Gentoo Image
Current Kurobox Gentoo Image Date: 2006/09/07
Using this method, you can install an entire Gentoo image complete with portage and overlay in about 15 minutes. The images were created immediately following a deep world update by russK. There are two versions and MD5 checksum files. One set for users with the stock bootloader and one set for those using U-Boot. They are stored in the Gentoo Downloads Section. Download the particular image for your installation.
Preparing for Install
Download needed files
You will need to download the desired gentoo image and the EM mode utilities from http://kurobox.com/downloads/gentoo. With the gentoo image, you have two images to choose from, depending on your bootloader.
- If you are using the stock bootloader (as with a factory-fresh kurobox) you need to download gentoo-20060907-stock.tar.bz2
- If you are using uboot, you need to download gentoo-20060907-uboot.tar.bz2
Note, with a factory fresh box, you still might want to consider flashing uboot, as it offers the advantage of booting 2.6 kernels (without resorting to module tricks) and running a more current system. Read up on uboot on the wiki and the forums before you decide, as it could save you from re-doing things later. Some people might be perfectly happy sticking with the stock firmware while others would prefer to jump in and flash the uboot firmware. Please heed the warnings about making a brick before proceeding. To be absolutely carefree about flashing, you should have JTAG capability.
Install EM mode utilities
Start by using any FTP client to upload EM_mode_binaries.tar.bz2 (you can download it from http://kurobox.com/downloads/gentoo to /tmp on the Kuro (hint: Windows may change the extension of the file when you download it from the internet).
Switch the box to EM mode (see the Frequently Asked Questions for details on how to do this), then login to kuro using a telnet client.
Kroutoshikou KURO-BOX (IETSUNA) kernel 2.4.17-kuro-box on ppc KURO-BOX-EM login: root Password: kuro (kuroadmin on HG)
Lets see what we've got
# df Filesystem 1k-blocks Used Available Use% Mounted on /dev/ram0 9677 5102 4575 53% / # ls /tmp EM_mode_binaries.tar.gz
Change to the root and untar the binaries.
# cd / # tar xvzf /tmp/EM_mode_binaries.tar.gz bin/
bin/sfdisk bin/fdisk bin/bzip2 bin/date bin/chroot #
Check and set the date.
# date Fri Feb 1 12:37:03 JST 2006 # date 02032238 Thu Feb 3 22:38:00 JST 2006
Partitioning & Formating the HDD
Note: The /etc/fstab file that comes with the Gentoo image is configured to work with this hard drive partitioning scheme. If you want to use a different partitioning scheme you must edit /etc/fstab accordingly. The flash contains the standard visual editor, vi. instructions for using vi are available at http://www.cs.colostate.edu/helpdocs/vi.html .
We run fdisk and create partitions. I use four partitions: hda1 for /, hda2 for the swap space, hda3 for /var, and hda4 for data storage (/datafiles). This section from the Gentoo Handbook explains how to prepare your hard disk (create partitions). For most users, 10gb each for / on hda1 and /var on hda3 is adequate. 512mb is good for a swap space on hda2 and use the remainder for /datafiles on hda4. However, you can decide which way you want to break up your hard disk. Remember you need to mount all of the drives (except the swap and /datafiles) before you untar the image (More on that later).
# fdisk /dev/hda
Once the partitions are created we format the partitions. Here we format the first partition on /dev/hda (the hard drive is /dev/hda).
# mke2fs -j /dev/hda1 mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09 Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 1251712 inodes, 2502115 blocks 125105 blocks (5.00%) reserved for the super user First data block=0 77 block groups 32768 blocks per group, 32768 fragments per group 16256 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. #
We do this for all of the partitions we plan to use.
# mke2fs -j /dev/hda3 . . . # mke2fs -j /dev/hda4
# mkswap /dev/hda2 Setting up swapspace version 1, size = 518184960 bytes #
Install Gentoo Image
Mount new partitions
This will allow us to create the gentoo system on the hard drive instead of in the flash ram disk. We will create the directoy /gentoo mount /dev/hda1 there, then create /gentoo/var and mount /dev/hda3.
# mkdir /gentoo # mount -t ext3 /dev/hda1 /gentoo # mkdir /gentoo/var # mount -t ext3 /dev/hda3 /gentoo/var
Extracting the Image
We now use our FTP client to upload the gentoo image we previously downloaded from http://www.kurobox.com/downloads/gentoo to the /gentoo directory on the kuro.
We then change directories to /gentoo and untar the image in what will be our root directory
# cd /gentoo # tar xvjf <gentoo-image-name>
Once the image is untarred we can delete the image from /gentoo.
# rm *.bz2
Next we change add GENTOO_MIRRORS and SYNC lines in /etc/make.conf to suit your location. Pick the three nearest sites listed at http://www.gentoo.org/main/en/mirrors.xml for your GENTOO_MIRRORS line. For Your SYNC line, your choices are namerica, samerica, europe, asia and au (australia) in place of namerica in my SYNC line.
# cd /gentoo/etc # vi make.conf
GENTOO_MIRRORS="<site 1> <site 2> <site 3>" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
Next we configure the network. If you want to use DHCP, you can skip this step as the image is configured for DHCP.
# cd conf.d # vi net
If you want a static IP address you need to uncomment a couple of lines. Scroll down to the section INTERFACE HANDLERS and uncomment the following lines. In the example I have set the IP address to 192.168.0.9, the network mask to 255.255.255.0, and the gateway to 192.168.0.1. Do not uncomment the default via 4321:0:1:2:3:4:567:89ab". You will want to change the IP address, subnet mask, and gateway address to suit your network.
config_eth0=( 192.168.0.9 netmask 255.255.255.0 broadcast 192.168.0.255 ) routes_eth0=( "default via 192.168.0.1" # "default via 4321:0:1:2:3:4:567:89ab" )
Now, you have to configure your DNS servers in resolv.conf file:
# vi /etc/resolv.conf
Example for /etc/resolv.conf:
nameserver 127.0.0.1 nameserver 126.96.36.199 nameserver 188.8.131.52 nameserver 184.108.40.206
You might need to get a kernel now
You can ignore this section if you do not use U-Boot.
If you are installing the image for U-Boot you will need to place a uImage formatted kernel into the directory specified in the hdfile environment variable in U-Boot.
If you are looking for a kernel at this point, Sylver has several pre-compiled kernels in his debian downloads area.
Clean up and Reboot
# cd / # umount /gentoo/var # umount /gentoo
Set the box to boot to the new system. By the way, that device is FL3 in lowercase.
# echo -n "OKOK" > /dev/fl3
and then restart the system
# shutdown -r now
Wait a few minutes and then log onto your kuro with putty. The first time the system boots it will take about 3 minutes as it needs to generate the certificates used by sshd.
Login as root with the password: kuroadmin.
Post Installation Tasks
First we set the root password and create a new user who is a member of wheel so they can su to root.
kurobox ~ # cd / kurobox # passwd New UNIX password: Retype new UNIX password: passwd: password updated successfully kurobox # useradd dtaylor -m -G users,wheel -s /bin/bash kurobox # passwd dtaylor New UNIX password: Retype new UNIX password: passwd: password updated successfully kurobox #
Now would be a good time to update everything.
kurobox / # emerge --sync && emerge -uNDv world
Last, if anything was updated and portage says we need to update our config files we run etc-update. Don't do this blindly as you can easily break your brand new system. You need to understand what the configuration files mean and choose what lines you want to edit.
kurobox / # etc-update
That's it. You're done. You should consider going to the Administrate Your Gentoo System page and installing some system utilities.