Difference between revisions of "ECS LIVA: Gentoo-based MythTV Backend & Frontend Setup Guide"

From MythTV Official Wiki
Jump to: navigation, search
(Configuration Files: Adding /etc/fstab content)
m (/etc/rc.conf: Added content)
Line 173: Line 173:
  
 
=== /etc/rc.conf ===
 
=== /etc/rc.conf ===
  (Need to add content)
+
Uncomment the line:
 +
  rc_parallel="NO"
  
 
== Chroot ==
 
== Chroot ==

Revision as of 01:22, 16 May 2015

Important.png Note: These instructions are a work-in-progress, and are not yet completed.
I will continue to update this page as I work through transcribing my notes, and capturing the setup configuration details from my completed and running Gentoo LIVA MythTV systems.
- DStulken (talk) 19:29, 10 May 2015 (UTC)



ECS LIVA: Gentoo-based MythTV Backend & Frontend Setup Guide


(Start instructions part way through: https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks
see also: http://forums.gentoo.org/viewtopic-p-7670034.html)


Important.png Note: This is *not* a step-by-step walk through that follows the Gentoo Handbook docs, nor is it a general-purpose guide for Gentoo on the LIVA, MythTV on Gentoo, or MythTV on the LIVA.
Instead, it is a condensed refinement of my setup notes and long list of lessens learned, which have been re-arranged and simplified to produce the easiest set of instructions sufficient to replicate my results from a new LIVA to a working BE+FE system in the shortest amount of time possible.  :-)


Installation Goals:

  • Absolutely bare-bones minimimal "lean-and-mean" OS and software installation
  • As optimized as possible for the LIVA's specific hardware
  • Full MythTV backend with multiple HD tuner support
  • Full MythTV frontend with hardware-accelerated playback, LIRC remote, etc.
  • Wireless networking using the wifi card that comes with the LIVA


Despite being out-of-order per the Gentoo Handbook, I'll try to leave enough comments that you can tell what is being done (and why), and also know the jumping off points for where to go for different installations for your own needs.
Feel free to make corrections, additions, or improvements, as long as you think they fit the theme and intent of my installation.  :-)

- DStulken (talk) 19:58, 10 May 2015 (UTC)



Prerequisites & Setup

Yourself

  • Lots of time. Even when streamlined, this installation will take SEVERAL DAYS to complete.
  • Previous experience with Gentoo, or a commitment to learn.

Hardware

  • A first-generation ECS LIVA from the SECOND or later production batch.
    • First generation first production batch has N2806 CPU (Not recommended)
    • First generation second (and later) production batch has N2807 CPU, and is the one to get.
      • The low-end version with 2GB RAM and 32GB eMMC flash is plenty. (No need to spend nearly twice as much for the 64GB version.)
      • At the time of this writing (May 2015), these regularly come up for sale online for $99-$109.
    • Second generation (called the "LIVA-X") has different hardware (CPU, wireless, BIOS, power method, etc, etc), and is not covered by this guide.
  • USB or networked TV tuners if you plan on running the backend
  • A USB hub (Possibly optional if you're not running a backend.)
  • A USB hard drive if you plan on running the backend
  • A LIRC-compatible USB IR receiver
  • A USB keyboard and mouse
  • A USB stick to use as the installation media

Assembly and First Boot

  • Assemble the LIVA from the parts included in the box
  • Configure LIVA BIOS options as follows:
 * ???? (copy from other machine)
  • Ensure you have a WIRED network connection available (wireless will not work within the Mint live environment or initial Gentoo until later on).
    • Setup of Gentoo without a network, using 'sneakernet' of packages, is possible... if you *really* can't do it any other way.
  • Gentoo live media won't boot on EFI system...
  • Boot the Mint USB stick on the LIVA
  • Open a terminal window

Disk (eMMC) Partitioning

  • Partition the LIVA's eMMC:

Using GParted:

  • The LIVA's eMMC is /dev/mmcblk0
  • Use a GPT partition table (Device -> Create Partition Table -> GPT type)
  • Ignore the "fix something" warnings if they come up.

Suggested partition layout:

(sda1) /dev/mmcblk0p1  128MB    fat32  'grub'      BIOS boot partition  (bios_grub flag)
(sda2) /dev/mmcblk0p2  128MB     ext2  'boot'      Boot partition
(sda4) /dev/mmcblk0p3  26.87GB   ext4  'rootfs'    Root partition
(-na-) /dev/mmcblk0p4  2GB       ext4  'tempData'  Data Partition (NOT SWAP!)

Apply, and close GParted.

Notes:

  • The 2GB 'tempData' partition is one I created so that I can save copies of database backups and config files on a separate partition in case anything happens that corrupts the root filesystem. Consider it optional.
  • No swap partition on the eMMC! (It will quickly kill it!)
  • No data partition on the eMMC! (32 or 64GB is waaaay too small.)
  • Create a reasonable size (4-8GB) swap partition on your USB hard drive that you are going to use for your recordings.


Set partition 1's type to EF00 using gdisk (gparted will call it "boot" after this)

sudo apt-get install gdisk
sudo gdisk /dev/mmcblk0
t
1
EF00
q


Initial Gentoo Installation

Stage 3 unpacking

In the terminal window from your Mint LiveUSB environment:

sudo su
mkdir /mnt/gentoo
mount /dev/mmcblk0p3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/mmcblk0p2 /mnt/gentoo/boot
cd /mnt/gentoo


Download the current stage-3 NO MULTILIB tarball. For maximum efficiency we are installing a pure 64-bit environment with NO 32-bit support.

apt-get install links
links http://www.gentoo.org/main/en/mirrors.xml

select a mirror near you

navigate to releases/amd64/autobuilds/[latest date]/stage3-amd64-nomultilib-[date].tar.bz2, and hit the 'd' key to download

(I personally use the newest dated file, not the 'current' named file. That way, if you copy it to another machine or a USB stick to use it for other installs, you have some context in the future as to how old that stage3 image actually is.)


extract the stage3 tarball

tar xvjpf stage3-amd64-nomultilib-[date].tar.bz2

Configuration Files

replace config files as follows

/etc/portage/make.conf:

(Need to add content)

Update your download mirrors for portage

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

(and re-edit /etc/portage/make.conf to remove the duplicate mirror list which was previously there from my installation)

/etc/portage/package.use

(Need to add content)

/etc/portage/package.keywords

(Need to add content)

/etc/fstab

Baseline LIVA internal filesystems:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't 
# needed); notail increases performance of ReiserFS (at the expense of storage 
# efficiency).  It's safe to drop the noatime options if you want and to 
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>			<mountpoint>	<type>		<opts>		<dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/mmcblk0p2		/boot		        ext2		noauto,noatime	1 2
/dev/mmcblk0p3		/		        ext4		noatime		0 1
#/dev/SWAP		none		        swap		sw		0 0
#/dev/cdrom		/mnt/cdrom	        auto		noauto,ro	0 0
#/dev/fd0		/mnt/floppy     	auto		noauto		0 0

Optional:
(Customize as necessary for your particular installation)

# USB 3.0 Seagate 2.0TB external HD 
/dev/sda1               /mnt/LIVA_USB_2TB       jfs             noatime         0 1
/dev/sda2               none                    swap            sw              0 0

# NFS shares
/mnt/LIVA_USB_2TB  /export/LIVA_USB_2TB  none  bind  0  0


/etc/rc.conf

Uncomment the line:

rc_parallel="NO"

Chroot

chroot to the Gentoo environment

cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

Misc

Update portage

emerge-webrsync
emerge --sync

(The first retrieves a day-old snapshot. The second updates the portage tree with the very latest updates.)


Read the news items and clear the news message during emerges

eselect news read all

Check that your profile is correct

eselect profile list

This should be defaulted to something like: [17] default/linux/amd64/13.0/no-multilib *
If it is showing something different, STOP NOW as you have installed with the wrong stage3 tarball!

Set the time zone and locales

ls /usr/share/zoneinfo
echo "US/Central" > /etc/timezone

(or your own time zone)

emerge --config sys-libs/timezone-data
nano -w /etc/locale.gen

un-commented both en_US locales (or your own locales)

locale-gen
eselect locale list
eselect locale set 4 

([4] en_US.utf8)
(or your own locale)


Update with the new configuration changes

env-update && source /etc/profile

Initial Gentoo Installation (Continued)

Kernel Setup & Boot Loader

Kernel Installation

Install the kernel source, and pciutils so that you can use 'lspci' to help you figure out the necessary kernel config options.

emerge --ask sys-kernel/gentoo-sources sys-apps/pciutils

Kernel Config

(Need to add content)
cd /usr/src/linux-[version]
make menuconfig  (and configure kernel)
- or - 
copy my config into /usr/src/linux/.config and run 'make oldconfig' to update it  (current as of kernel version 3.18.11)

Kernel Build & Copy

make && make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-[version]-gentoo-test1
cp .config /boot/config-[version]-gentoo-test1

To keep things straight, I append '-test#' to my kernel builds and kernel config files, and increment the number when I build multiple variants of the same kernel version.

Boot Loader

Network Setup

Wi-Fi Network

MythTV Setup

Reference Information

Hardware Information

lspci -v

00:00.0 Host bridge: Intel Corporation Atom Processor Z36xxx/Z37xxx Series SoC Transaction Register (rev 0e)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, fast devsel, latency 0
	Kernel driver in use: iosf_mbi_pci
	Kernel modules: iosf_mbi

00:02.0 VGA compatible controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Graphics & Display (rev 0e) (prog-if 00 [VGA controller])
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, fast devsel, latency 0, IRQ 261
	Memory at d0000000 (32-bit, non-prefetchable) [size=4M]
	Memory at c0000000 (32-bit, prefetchable) [size=256M]
	I/O ports at f020 [size=8]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: [d0] Power Management version 2
	Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [b0] Vendor Specific Information: Len=07 <?>
	Kernel driver in use: i915

00:14.0 USB controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series USB xHCI (rev 0e) (prog-if 30 [XHCI])
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, medium devsel, latency 0, IRQ 263
	Memory at d0700000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [70] Power Management version 2
	Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
	Kernel driver in use: xhci_hcd

00:1a.0 Encryption controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Trusted Execution Engine (rev 0e)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, fast devsel, latency 0, IRQ 255
	Memory at d0500000 (32-bit, non-prefetchable) [size=1M]
	Memory at d0400000 (32-bit, non-prefetchable) [size=1M]
	Capabilities: [80] Power Management version 3
	Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit-

00:1b.0 Audio device: Intel Corporation Atom Processor Z36xxx/Z37xxx Series High Definition Audio Controller (rev 0e)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, fast devsel, latency 0, IRQ 264
	Memory at d0714000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation Device 0f48 (rev 0e) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	I/O behind bridge: 00001000-00001fff
	Memory behind bridge: 80000000-801fffff
	Prefetchable memory behind bridge: 0000000080200000-00000000803fffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Elitegroup Computer Systems Device 99ad
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation Device 0f4a (rev 0e) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
	I/O behind bridge: 00002000-00002fff
	Memory behind bridge: 80400000-805fffff
	Prefetchable memory behind bridge: 0000000080600000-00000000807fffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Elitegroup Computer Systems Device 99ad
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1c.2 PCI bridge: Intel Corporation Device 0f4c (rev 0e) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
	I/O behind bridge: 0000e000-0000efff
	Memory behind bridge: d0600000-d06fffff
	Prefetchable memory behind bridge: 0000000080800000-00000000809fffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Elitegroup Computer Systems Device 99ad
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation Device 0f4e (rev 0e) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
	I/O behind bridge: 00003000-00003fff
	Memory behind bridge: 80a00000-80bfffff
	Prefetchable memory behind bridge: 0000000080c00000-0000000080dfffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Elitegroup Computer Systems Device 99ad
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1f.0 ISA bridge: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Power Control Unit (rev 0e)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, medium devsel, latency 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:1f.3 SMBus: Intel Corporation Device 0f12 (rev 0e)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: medium devsel, IRQ 18
	Memory at d071c000 (32-bit, non-prefetchable) [size=32]
	I/O ports at f000 [size=32]
	Capabilities: [50] Power Management version 3

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
	Subsystem: Elitegroup Computer Systems Device 99ad
	Flags: bus master, fast devsel, latency 0, IRQ 262
	I/O ports at e000 [size=256]
	Memory at d0604000 (64-bit, non-prefetchable) [size=4K]
	Memory at d0600000 (64-bit, prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [70] Express Endpoint, MSI 01
	Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
	Capabilities: [d0] Vital Product Data
	Kernel driver in use: r8169


cat /proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 55
model name	: Intel(R) Celeron(R) CPU  N2807  @ 1.58GHz
stepping	: 8
microcode	: 0x811
cpu MHz		: 1580.800
cache size	: 1024 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse 
sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf 
pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer rdrand 
lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bugs		:
bogomips	: 3161.60
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 55
model name	: Intel(R) Celeron(R) CPU  N2807  @ 1.58GHz
stepping	: 8
microcode	: 0x811
cpu MHz		: 1580.800
cache size	: 1024 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse 
sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf 
pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer rdrand 
lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bugs		:
bogomips	: 3161.60
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management: