px
px
border
px
   
px
div
Information
null.gif Home

null.gif News
 Topics
 Stories Archive
null.gif Content
 Articles
 Tutorials
 Downloads
 Web Links
 Forums
null.gif Other Stuff
interdit Feedback
 Recommend Us
 Statistics
 Search
 RSS
 Your Account

Digital Video
Installing MythTV
MythWeb Hacks
Remote Control
Hardware Kit
Complete System

Digital Surveillance
Installing Zoneminder
Hardware Kit

VIA EPIA
Comparison Chart
Performance
Optimizing

Store Information
Shipping & Returns
Privacy Notice
Conditions of Use
Contact Us

div
  TopMy Account  |  Cart Contents  |  Checkout   
Installing MythTV - Part 3
Base OS

Table Of Contents

In this section we configure the BIOS, partition the hard drive, and install Gentoo Linux on our system.

Before we get down to business I need to point out that what we're going to do won't happen fast. If you're starting in the morning hoping to record a special show this evening with your new MythTV system, this isn't going to get you there. This is going to take several days at best and probably longer. Installing Gentoo Linux alone will take a day.

However, if you like to tinker and want to learn a little about computers, if the journey is as important to you as the destination, there let's get going.

Prerequisites

We'll assume that you have hardware roughly similar to that described in Part 2. It will need a CD drive for installing the operating system even if you don't plan to use a CD drive long term. It will also need a connection to the Internet. Almost all of the software we'll install will be downloaded directly from the Internet.

To create the CD you will need a computer with a CD-RW drive and an Internet connection. Below you will download a CD iso image and you will need to burn that to a CD. If you have a CD-RW drive your CD writer software should have the ability to burn a CD from an iso image.

BIOS Settings

First we will set the BIOS for our system mostly to turn off BIOS options we don't need. Turn on the power and press the DEL key during the self test (you may need to press it many times). This will get you into the BIOS setup utility which looks like this:

Under Standard CMOS Features, set the Date and Time.

Under Advanced BIOS Features, make sure you have CDROM as the first boot device.

For Advanced Chipset Features, set the TV Type for your TV. US is NTSC while Europe and most of the rest of the world is PAL.

For Integrated Peripherals/SuperIO Device, I disable everything since I don't use them. You may want to do likewise.

Here's what I have for Power Management Setup.

And finally, Plug-And-Play.

Note: I will probably disable "Assign IRQ For USB" in a future installation since I don't compile USB support into the kernel and it isn't needed. As always, do what is best for your system.

Gentoo Linux

We will use Gentoo Linux as the operating system. The key benefit of Gentoo is the degree to which we can customize and optimize it for the system we are building. Gentoo is installed from source code and compiled on the system with just the options we require.

Gentoo also has a technology called Portage. Portage is a software distribution mechanism that makes it almost trivial to install and update software packages.

The Gentoo website has an excellent Installation Handbook. You will need it available as we work through the installation. We will often refer to the handbook or direct you to it for certain steps in the process.

Getting Gentoo

First we need a Gentoo CD that we can use to boot our system. We will use what Gentoo calls the "Minimal LiveCD". This is a CD that boots the system and prepares it for Internet access. All of the software needed to install Gentoo is retrieved from the Internet.

To get the Gentoo LiveCD go to the list of mirrors and select a site you like. Navigate to releases/x86/2004.3/livecd and download the file install-x86-minimal-2004.3-r1.iso. Use your favorite CD burning software and burn this CD image to a CD.

Booting Gentoo

Next we boot the system using the CD. If it doesn't boot you may need to go into the BIOS and set the CD drive as the first boot device. It should give you the Gentoo splash screen and a boot: prompt. Simply press the Enter key.

Once booted into Gentoo you will be presented with a command prompt. (Yes, all of our work will be from the command prompt.) The first thing you should do is set your password. You do that by typing passwd at the prompt and following the instructions. The password is only for the installation and not permanent. You will need this if you later want to open another terminal so you can do several things with the system at once.

Configuring Your Network

Gentoo will recognize the network adapter in your VIA mainboard (via-rhine). Unless your network is using DHCP you will need to settings for your network (e.g. ip address and gateway address). Refer to chapter 3 of the Gentoo Installation Handbook for help.

Preparing Your Hard Drive

Before we can use the hard drive it will need partitions. Partitions on a hard drive are like partitions in a room. They divide the space up so we can use them for different purposes. We will create 3 partitions on the hard drive. The first partition is for the Linux /boot directory. Making the /boot directory its own partition is a security feature used by Gentoo. After the system boots the /boot partition can be unmounted thus making it more difficult for some malicious process to permanently modify the kernel. The second partition will be used for swap space while the third partition is the rest of the disk.

The program we use to partition the hard drive is fdisk. Type this at the command line and press Enter. The Gentoo Installation Handbook does a good job describing the use of fdisk. Refer to chapter 4 and look for the section Creating the Boot Partition. Follow the instructions from there to the end of section 4.c.

You will create three partitions. All three will be primary partitions. The first will hold the /boot directory and should be 32MB. Make sure you toggle the boot flag on the first partition with the "a" command. The second partition is for swap and will be 256MB. You will need to change the "type" with the "t" command to 82, Linux swap. The third partition will be the root filesystem and should take the remaining space on your hard drive. When you are finished press "p" to print your partition table. It should look something like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          63       31720+  83  Linux
/dev/hda2              64         560      250488   82  Linux swap / Solaris
/dev/hda3             561       77545    38800440   83  Linux

Creating Filesystems

Now that the hard drive is partitioned, we need to install a filesystem on each partition. What does that mean? By creating partitions on the hard drive we have made space available on the hard drive just like partitions in a room make space available. Now we need to go ahead and use the space. The filesystem puts the necessary "decorations" in the partition so we can use them to store files or work as swap space.

Linux has several different filesystems available each with certain strengths and weaknesses for different purposes. The /boot partition (/dev/hda1) is largely read-only so we don't need any of the new journaling filesystems. We will use the old, reliable workhorse ext2 for it.

The root partition (/dev/hda3) needs some thought. Since we are using this as a MythTV system we know that we will be creating and deleting some very large files. We need a filesystem that does this well. From our experiences XFS does this well and has proved itself very reliable.

To create these filesystems enter the following from the shell prompt:

#mke2fs /dev/hda1
#mkswap /dev/hda2
#mkfs.xfs /dev/hda3

Mounting the Filesystems

We've created the filesystems now we need to gain access to them. We do this by mounting them as follows:

#mount /dev/hda3 /mnt/gentoo
#mkdir /mnt/gentoo/boot
#mount /dev/hda1 /mnt/gentoo/boot

We'll also go ahead and turn on the swap partition:

#swapon /dev/hda2

Recap

So what have we accomplished? We have our MythTV system booted into a Gentoo installation environment. The hard drive is partitioned and has filesystems installed. The filesystems are mounted so we can access them. They are, however, empty. Next we will load the Gentoo files from the Internet so we can start the installation.

Loading The Gentoo Installation Files

We're going to do what Gentoo calls a Stage 1 installation. It takes a little longer but gives us the most chances to customize and optimize the installation. We will retrieve the files we need from the Internet.

First change to the new filesystem root we created and mounted earlier so we have a place to put the files we download.

#cd /mnt/gentoo

Next we'll download the stage 1 tarball. We'll do the same thing we did earlier with the LiveCD download except now we're doing it from our target system. Go to the list of mirrors and select a site you like:

#links2 http://www.gentoo.org/main/en/mirrors.xml

Next navigate to releases/x86/2004.3/stages/x86 and download the file stage1-x86-2004.3.tar.bz2.

While we're there we will go ahead and download the portage snapshot which we will need a little later. Go back to the top directory and navigate to snapshots and download the latest snapshot like portage-20041215.tar.bz2.

NOTE: It is a good idea to verify the downloads by checking the MD5 hash. For each file you downloaded also download the corresponding *.md5sum file. Then verify the download with the following:

#md5sum -c stage1-x86-2004.3.tar.bz2.md5

Do the same thing for the portage snapshot (the file extension .md5sum instead of .md5).

Unpack The Tarballs

Enter the following to unpack the tarballs we downloaded:

#tar -xvjpf stage1-x86-2004.3.tar.bz2
#tar -xvjf portage-20041215.tar.bz2 -C /mnt/gentoo/usr

Of course you will use the filenames for the files you downloaded. Note that the flags used are different between the two. What this does is load your system with some of the basic source code needed to build your system. In the next section we will compile the source to create executable files.

Configuring the Compile Options

Now things get interesting. We're about to compile the source code for our system. But first we want to set flags so the resulting binaries are optimized for our system. These flags are contained in the make.conf file. To edit that file type the following:

#nano -w /mnt/gentoo/etc/make.conf

Add the following lines to your make.conf file.

USE="-* aac acpi alsa apache2 cdr crypt curl dvd mmap mmx mysql pam perl php python sse ssl tcpd truetype X zlib"
CFLAGS="-march=i686 -pipe -O2 -fomit-frame-pointer -ffast-math -finline-functions -msse -mfpmath=sse,387"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
PORTDIR_OVERLAY="/usr/local/portage"

The "C" flags are used by the compiler. The USE flag indicates different modules we want to install in our MythTV system. Some programs use these to automatically install optional features. The PORTDIR_OVERLAY will be needed later when we load the kernel. We put it in now so we won't have to come back to this file later.

CHROOTING

We now have the foundations of our new environment installed and need to enter or "chroot" into it. The Gentoo Installation Handbook talks about this in chapter 6. To fully prepare the chroot environment we need a couple things from the existing environment. First, so our chroot environment can find stuff on the Internet, we need DNS. To enable that do:

#cp /etc/resolv.conf /mnt/gentoo/etc

Second we want access to the proc filesystem so the installation scripts can get information automatically about our system. To enable that we'll mount it with:

#mount -t proc none /mnt/gentoo/proc

Now chroot into the new environment:

#chroot /mnt/gentoo /bin/bash

This will give you a shell prompt. The handbook also tells us to run the following:

#env-update
#source /etc/profile

Bootstrapping

You don't need to update the portage tree as described in the handbook since we loaded the latest snapshot earlier. We've also already configured the USE flags. So the next thing we are going to perform is what Gentoo calls bootstrap. This will build the environment we need to build the system. Its kinda like building the tools you'll need to build a house. It's going to run for several hours so plan accordingly.

#cd /usr/portage
#scripts/bootstrap.sh

Now that we have our tools built, we can build the system. We can now use the Gentoo portage tool to install software. At the shell prompt type the following:

#emerge -e system

This will take even longer than the bootstrap so enjoy a break.

Configure and Build The Kernel

First we'll get the kernel source code. On a Gentoo system this is simple. Enter the following from a shell prompt:

#emerge gentoo-dev-sources

Next we will configure the kernel. There is a menu-based configuration tool that makes this process easier. Start it up with the following:

#cd /usr/src/linux
#make menuconfig

This will present you with a menu. You move the menu selector up and down with the up/down cursor keys. You select an action (items across the bottom) with the left/right cursor keys. Once you navigate to a specific item you can cycle through the choices with the space bar.

Here's an example. The list below shows you the menu items you should update for your system. The first line says we should enable "module unloading." First navigate to the "Loadable module support" menu item and press Enter (the action at the bottom defaults to Select so pressing Enter selects the menu item). Then press the down cursor key to highlight "Module unloading." Press the space bar until "*" appears next to the item. Then press the right cursor key to select the "Exit" action and press Enter. That takes us back to the previous menu. Continue this process for each item below. If an item in the list is empty, that means it is set by default and we need to "unset" it. Just press the space bar until the option is cleared.

As you go through the various menus, take a look at the options. You can select the "Help" action to give you more information about items you don't understand. This is a good way to learn about what a kernel does in general and the capabilities of Linux specifically.

Loadable module support -> [*] Module unloading
Processor type and features -> Processor family -> (X) VIA C3-2 (Nehemiah)
Processor type and features -> [ ] Symmetric multi-processing support
Power management options -> ACPI Support -> [ ] Sleep States
Power management options -> ACPI Support -> < > AC Adapter
Power management options -> ACPI Support -> < > Battery
Bus options -> [ ] ISA support
Device Drivers -> Parallel port support -> [ ] Parallel port support
Device Drivers -> Block devices -> < > Normal floppy disk support
Device Drivers -> Block devices -> [ ] Support for Large Block Devices
Device Drivers -> ATA/ATAPI... support -> [ ] CMD640 chipset bugfix/support
Device Drivers -> ATA/ATAPI... support -> < > RZ1000 chipset bugfix/support
Device Drivers -> ATA/ATAPI... support -> < > Intel PIIXn chipset support
Device Drivers -> ATA/ATAPI... support -> <*> VIA82CXXX chipset support
Device Drivers -> SCSI device support -> (clear all)
Device Drivers -> IEEE 1394 (FireWire) support -> <M> IEEE 1394 support
Device Drivers -> Networking support -> Ethernet (10 or 100Mbit) -> < > RealTeck RTL-8139
Device Drivers -> Networking support -> Ethernet (10 or 100Mbit) -> <*> VIA Rhine support
Device Drivers -> Networking support -> Ethernet (10 or 100Mbit) -> [*] Use MMIO instead of PIO
Device Drivers -> Character devices -> [ ] Legacy (BSD) PTY support
Device Drivers -> Character devices -> Linux InfraRed Controllers -> <M> Linux InfraRed Controller
Device Drivers -> Character devices -> <*> Intel/AMD/VIA HW Random Number Generator support
Device Drivers -> Character devices -> <M> /dev/agpgart (AGP Support)
Device Drivers -> Character devices -> < >   Intel 440XL/BX/GX, I8xx and E7x05 chipset support
Device Drivers -> Character devices -> < >   Intel i865 chipset support
Device Drivers -> Character devices -> <M>   VIA chipset support
Device Drivers -> Character devices -> <M> Direct Rendering Manager
Device Drivers -> I2C support -> <M> I2C support
Device Drivers -> I2C support -> <M> I2C device interface
Device Drivers -> I2C support -> I2C Hardware Bus support -> <M> VIA 82C586B
Device Drivers -> I2C support -> I2C Hardware Bus support -> <M> VIA 82C596/82C686/823x
Device Drivers -> Multimedia devices -> <M> Video For Linux
Device Drivers -> Graphics support -> [*] Support for frame buffer devices
Device Drivers -> Sound -> Advanced Linux Sound Architecture -> PCI Devices -> < > Intel i8x0/MX440
Device Drivers -> Sound -> Advanced Linux Sound Architecture -> <M> VIA 82C686A/B, 8233/8235 AC97 Controller
File systems -> < > Ext3 journalling file system support
File systems -> <*> XFS filesystem support
File systems -> DOS/FAT/NT Filesystems -> < > DOS FAT fs support
Profiling support -> [ ] Profiling support

Once you've set each item, select the "Exit" action from top menu level to exit the configuration menu. It will ask you if you want to save your configuration. Answer YES.

Edit /etc/fstab

#nano -w /etc/fstab

fstab describes our partitions and filesystems to the kernel. The BOOT, ROOT, SWAP lines should look like this:

/dev/hda1/bootext2noauto,noatime1 1
/dev/hda3/xfsnoatime0 0
/dev/hda2noneswapsw0 0

Compile The Kernel Now we are ready to compile and install the kernel. First mount the boot partition so the kernel can be installed then invoke the compiler.

#mount /boot
#make && make install

If mounting the /boot partition gives an error and says the partition is already mounted, that's ok. Just keep going. The second line actually invokes two commands in a single line. First "make" then when it completes "make install". The process doesn't take too long. Less than 20 minutes. When it completes say "no" when it asks you to make a boot disk. Important: Ignore the ominous error it gives about your now unbootable system.

Next compile and install the kernel modules.

#make modules modules_install
#modules-update

The Home Stretch

We're almost done. Just a little more system configuration and install a couple more modules and that's it.

1. Set Timezone

#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

Of course you will select your timezone and not GMT (unless that's your timezone). You can view all the timezones available with: #ls /usr/share/zoneinfo. Note: This is actually more important than it might appear. When you're done installing MythTV, if the channel listing has shows at the wrong time, it is probably due to an incorrect timezone entry.

NOTE: MythTV 0.17 plus the latest version of Qt has an issue with daylight savings time (DST). During DST the program guide will have shows one hour early. To work around this problem you will need to select a timezone that doesn't have DST and is one hour before your timezone. For example, normally I would select PST8PDT since I'm on the US left coast. However since we're currently in DST I need to set my timezone to MST or Mountain time.

2. Set hostname and domain name

#echo mythtv > /etc/hostname
#echo home > /etc/dnsdomainname
#rc-update add domainname default

These can be anything you like. If your system is part of an existing domain you will want to use that domain name.

3. Configure Networking

Earlier we configured the network for our Gentoo installation environment. We need to do it again for our completed system. To configure the network edit the "net" configuration file:

#nano -w /etc/conf.d/net

If you have a static IP address you will need to enter something like this:

iface_eth0="192.168.123.30 broadcast 192.168.123.255 netmask 255.255.255.0"
gateway="eth0/192.168.123.1"

If your network uses DHCP you will need these lines:

iface_eth0="dhcp"
dhcpcd_eth0="-h `hostname`"

Note the back-tick ("`" ) around "hostname".

Finally, to have your network startup automatically when your system boots, enter the following:

#rc-update add net.eth0 default

Edit /etc/hosts file (if static ip). In my case I have:

127.0.0.1 localhost
192.168.123.30mythtv.homemythtv

4. Set root password

#passwd

New UNIX password: <your root password>
Retype new UNIX password: <your root password>
passwd: password updated successfully

5. Install system tools

If you selected dhcp for your network configuration:

#emerge dhcpcd

All systems should install the following.

#emerge syslog-ng
#emerge logrotate
#emerge vixie-cron
#emerge xfsprogs
#emerge pciutils
#emerge zip
#emerge udev

Isn't the Gentoo portage system cool? One neat feature you may have noticed, if a package has dependencies on other packages, the portage facility will automatically install those packages. And they are all installed from source so they will be optimized for your system.

Some of the things we installed above are services that need to start when the system starts. To make this happen enter the following:

#rc-update add syslog-ng default
#rc-update add vixie-cron default

Install Boot Loader

The boot loader is called by your computer's BIOS at the end of the boot sequence to load the kernel. We will use Grub as our boot loader.

#emerge grub

To install grub on the boot sector of your hard drive, enter the following:

#grub

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Finally, edit the grub configuration file:

#nano -w /boot/grub/grub.conf

Your grub configuration should look something like this:

timeout 10
default 0

# For booting GNU/Linux
title  MythTV
root (hd0,0)
kernel /vmlinuz root=/dev/hda3

# For booting into maintenance mode
title Maintenance Mode
root (hd0,0)
kernel /vmlinuz root=/dev/hda3 single

Save your changes and exit the editor.

Its ok to go ahead and remove the files we downloaded to install Gentoo.

#rm /portage*
#rm /stage1*

That's it! Now we can exit the chroot environment, umount the stuff we mounted at the beginning and reboot.

#exit
#cd /
#umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
#reboot

Remove the Gentoo CD while the system runs through its self tests otherwise it will boot from the CD again. Now the system will boot from the hard drive and your new Gentoo installation. Congratulations!

Next: Part 4 – Prerequisite Software

History
9 Feb 2005Initial Publication
8 Apr 2005Updated for MythTV 0.17
Updated “Build The Kernel” section to use Gentoo Dev Sources
16 May 2005Added “maintenance mode” to boot options









Tim

Copyright © by MagicITX All Right Reserved.

Published on: 2005-02-08 (14287 reads)

[ Go Back ]
div
Survey
Are you doing a Car-PC project?

Yes, active now
Yes, planning stage
Thinking about it
No, not interested



Results
Polls

Votes: 329
Comments: 0

Login
Login Name

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Who's Online
There are currently, 5 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

div



MagicITX Logo © 2004.
All other logos and trademarks in this site are property of their respective owner. Comments are the property of their poster.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty for details see the license.
Page Generation: 0.119 Seconds