Openelec
(Created page with "I want an OpenELEC media PC for my TV. And I want it to boot over NFS... Here goes! ==Get your hands on a release!== I picked the [http://releases.openelec.tv/OpenELEC-Gener...") |
m (→Investigate the release) |
||
Line 90: | Line 90: | ||
The <code>OpenELEC-Generic.i386-1.95.5/target/SYSTEM</code> and <code>OpenELEC-Generic.i386-1.95.5/target/KERNEL</code> files are the most interesting here. | The <code>OpenELEC-Generic.i386-1.95.5/target/SYSTEM</code> and <code>OpenELEC-Generic.i386-1.95.5/target/KERNEL</code> files are the most interesting here. | ||
The rest is really support fluff... | The rest is really support fluff... | ||
+ | |||
+ | ===Look inside the SYSTEM image=== | ||
+ | <source lang="bash"> | ||
+ | mkdir system && sudo mount -o loop ./SYSTEM ./system | ||
+ | </source> | ||
+ | |||
+ | <code>/usr/bin/Xorg</code> is present, and <code>/usr/lib/xbmc/xbmc.bin</code> | ||
+ | |||
+ | ===Look inside the KERNEL image=== | ||
+ | <source lang="bash"> | ||
+ | $ file KERNEL | ||
+ | KERNEL: Linux kernel x86 boot executable bzImage, version 3.2.21 (jetstream@1801-lin007) #1 SMP Fri Jul 6 01:46:03 CEST 2, RO-rootFS, swap_dev 0x4, Normal VGA | ||
+ | $ grep -P -a -b --only-matching $'\xfd\x37\x7a\x58\x5a\x00' KERNEL | ||
+ | 14946:?7zXZ | ||
+ | 5133180:?7zXZ | ||
+ | </source> | ||
+ | Despite the fact that <code>file</code> states that this is a bzImage, I don't believe it... There are two <code>xz</code> magic headers, lets dig... | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ dd if=KERNEL bs=1 skip=14946 of=KERNEL.a.xz | ||
+ | 5120734+0 records in | ||
+ | 5120734+0 records out | ||
+ | 5120734 bytes (5.1 MB) copied, 9.08123 s, 564 kB/s | ||
+ | $ dd if=KERNEL bs=1 skip=5133180 of=KERNEL.b.xz | ||
+ | 2500+0 records in | ||
+ | 2500+0 records out | ||
+ | 2500 bytes (2.5 kB) copied, 0.0062067 s, 403 kB/s | ||
+ | $ file KERNEL.a.xz KERNEL.b.xz | ||
+ | KERNEL.a.xz: XZ compressed data | ||
+ | KERNEL.b.xz: XZ compressed data | ||
+ | </source> | ||
+ | These files will start with XZ compressed data, but when that ends, there is some other binary data. To decompress we need to use the <code>--single-stream</code> argument to <code>xz</code> so that it won't label the data corrupt because of this. | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ cat KERNEL.a.xz | xz -d --single-stream > KERNEL.a | ||
+ | $ cat KERNEL.b.xz | xz -d --single-stream > KERNEL.b | ||
+ | xz: (stdin): Compressed data is corrupt | ||
+ | </source> | ||
+ | Looks like the second Magic header was present for some other reason. Perhaps it's part of the decompression engine? | ||
+ | |||
+ | Now we have the uncompressed kernel, we also have the initramfs and the contents of <code>/proc/config.gz</code> avaliable (inside <code>KERNEL.a</code>). | ||
+ | <source lang="bash"> | ||
+ | $ grep -P -a -b --only-matching $'\x1f\x8b\x08\x00' KERNEL.a | ||
+ | 5229342: | ||
+ | 6605512: | ||
+ | 10308181: | ||
+ | $ for i in $(grep -P -a -b --only-matching $'\x1f\x8b\x08\x00' KERNEL.a | cut -d : -f 1); do dd if=KERNEL.a of=KERNEL.a.${i}.gz bs=1 skip=${i}; done | ||
+ | 7551598+0 records in | ||
+ | 7551598+0 records out | ||
+ | 7551598 bytes (7.6 MB) copied, 14.7439 s, 512 kB/s | ||
+ | 6175428+0 records in | ||
+ | 6175428+0 records out | ||
+ | 6175428 bytes (6.2 MB) copied, 11.0656 s, 558 kB/s | ||
+ | 2472759+0 records in | ||
+ | 2472759+0 records out | ||
+ | 2472759 bytes (2.5 MB) copied, 4.82829 s, 512 kB/s | ||
+ | $ file KERNEL.a.*.gz | ||
+ | KERNEL.a.10308181.gz: gzip compressed data, ASCII, has comment, comment | ||
+ | KERNEL.a.5229342.gz: gzip compressed data, ASCII, has CRC, was "", last modified: Tue May 7 14:40:32 2013, max speed | ||
+ | KERNEL.a.6605512.gz: gzip compressed data, from Unix, max compression | ||
+ | </source> | ||
+ | |||
+ | Looking good... I wonder which is the kernel config? | ||
+ | <source lang="bash"> | ||
+ | cat KERNEL.a.6605512.gz | gzip -d | less | ||
+ | </source> | ||
+ | And does it support "<i>Root file system on NFS</i>"/<code>CONFIG_ROOT_NFS</code> (yes) and "<i>IP: kernel level autoconfiguration</i>"/<code>CONFIG_IP_PNP</code> (yes)? | ||
+ | <source lang="bash"> | ||
+ | CONFIG_ROOT_NFS=y | ||
+ | CONFIG_IP_PNP=y | ||
+ | CONFIG_IP_PNP_DHCP=y | ||
+ | </source> |
Revision as of 21:24, 6 August 2012
I want an OpenELEC media PC for my TV. And I want it to boot over NFS...
Here goes!
Contents |
Get your hands on a release!
I picked the v1.95.5 build from http://openelec.tv/get-openelec.
Investigate the release
$ tar -xvf OpenELEC-Generic.i386-1.95.5.tar.bz2 OpenELEC-Generic.i386-1.95.5/ OpenELEC-Generic.i386-1.95.5/licenses/ OpenELEC-Generic.i386-1.95.5/licenses/LGPL2.txt OpenELEC-Generic.i386-1.95.5/licenses/GPL3.txt OpenELEC-Generic.i386-1.95.5/licenses/MIT_Modified.txt OpenELEC-Generic.i386-1.95.5/licenses/GPL.txt OpenELEC-Generic.i386-1.95.5/licenses/BSD_3_Clause.txt OpenELEC-Generic.i386-1.95.5/licenses/ATI.txt OpenELEC-Generic.i386-1.95.5/licenses/FDL1_2.txt OpenELEC-Generic.i386-1.95.5/licenses/MPL1_1.txt OpenELEC-Generic.i386-1.95.5/licenses/Artistic.txt OpenELEC-Generic.i386-1.95.5/licenses/LGPL3.txt OpenELEC-Generic.i386-1.95.5/licenses/Clarified_Artistic.txt OpenELEC-Generic.i386-1.95.5/licenses/Radeon_rlc.txt OpenELEC-Generic.i386-1.95.5/licenses/FDL.txt OpenELEC-Generic.i386-1.95.5/licenses/MIT.txt OpenELEC-Generic.i386-1.95.5/licenses/Public_Domain.txt OpenELEC-Generic.i386-1.95.5/licenses/GPL2.txt OpenELEC-Generic.i386-1.95.5/licenses/FDL1_3.txt OpenELEC-Generic.i386-1.95.5/licenses/Info-ZIP.txt OpenELEC-Generic.i386-1.95.5/licenses/NVIDIA.txt OpenELEC-Generic.i386-1.95.5/licenses/LGPL2_1.txt OpenELEC-Generic.i386-1.95.5/licenses/APSL.txt OpenELEC-Generic.i386-1.95.5/licenses/BSD_4_Clause.txt OpenELEC-Generic.i386-1.95.5/licenses/BSD_2_Clause.txt OpenELEC-Generic.i386-1.95.5/licenses/BSD.txt OpenELEC-Generic.i386-1.95.5/create_installstick OpenELEC-Generic.i386-1.95.5/create_virtualimage OpenELEC-Generic.i386-1.95.5/CHANGELOG OpenELEC-Generic.i386-1.95.5/openelec.ico OpenELEC-Generic.i386-1.95.5/README.md OpenELEC-Generic.i386-1.95.5/3rdparty/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/extlinux.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/isolinux.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/CodingStyle.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/mboot.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/logo/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/logo/syslinux-100.png OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/comboot.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/menu.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/rfc5071.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/pxelinux.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/gpt.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/syslinux.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/keytab-lilo.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/SubmittingPatches.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/memdisk.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/usbkey.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/distrib.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/doc/sdi.txt OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/win64/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/win64/syslinux64.exe OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/NEWS OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/dos/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/dos/syslinux.com OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/win32/ OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/win32/syslinux.exe OpenELEC-Generic.i386-1.95.5/3rdparty/syslinux/README OpenELEC-Generic.i386-1.95.5/3rdparty/md5sum/ OpenELEC-Generic.i386-1.95.5/3rdparty/md5sum/md5sum.exe OpenELEC-Generic.i386-1.95.5/3rdparty/md5sum/README OpenELEC-Generic.i386-1.95.5/RELEASE OpenELEC-Generic.i386-1.95.5/sample.conf/ OpenELEC-Generic.i386-1.95.5/sample.conf/extlinux.conf OpenELEC-Generic.i386-1.95.5/sample.conf/grub.conf OpenELEC-Generic.i386-1.95.5/sample.conf/syslinux.cfg OpenELEC-Generic.i386-1.95.5/sample.conf/syslinux_installer.cfg OpenELEC-Generic.i386-1.95.5/create_installstick.exe OpenELEC-Generic.i386-1.95.5/target/ OpenELEC-Generic.i386-1.95.5/target/SYSTEM OpenELEC-Generic.i386-1.95.5/target/KERNEL.md5 OpenELEC-Generic.i386-1.95.5/target/SYSTEM.md5 OpenELEC-Generic.i386-1.95.5/target/KERNEL OpenELEC-Generic.i386-1.95.5/create_installstick.bat OpenELEC-Generic.i386-1.95.5/INSTALL
The OpenELEC-Generic.i386-1.95.5/target/SYSTEM
and OpenELEC-Generic.i386-1.95.5/target/KERNEL
files are the most interesting here.
The rest is really support fluff...
Look inside the SYSTEM image
mkdir system && sudo mount -o loop ./SYSTEM ./system
/usr/bin/Xorg
is present, and /usr/lib/xbmc/xbmc.bin
Look inside the KERNEL image
$ file KERNEL KERNEL: Linux kernel x86 boot executable bzImage, version 3.2.21 (jetstream@1801-lin007) #1 SMP Fri Jul 6 01:46:03 CEST 2, RO-rootFS, swap_dev 0x4, Normal VGA $ grep -P -a -b --only-matching $'\xfd\x37\x7a\x58\x5a\x00' KERNEL 14946:?7zXZ 5133180:?7zXZ
Despite the fact that file
states that this is a bzImage, I don't believe it... There are two xz
magic headers, lets dig...
$ dd if=KERNEL bs=1 skip=14946 of=KERNEL.a.xz 5120734+0 records in 5120734+0 records out 5120734 bytes (5.1 MB) copied, 9.08123 s, 564 kB/s $ dd if=KERNEL bs=1 skip=5133180 of=KERNEL.b.xz 2500+0 records in 2500+0 records out 2500 bytes (2.5 kB) copied, 0.0062067 s, 403 kB/s $ file KERNEL.a.xz KERNEL.b.xz KERNEL.a.xz: XZ compressed data KERNEL.b.xz: XZ compressed data
These files will start with XZ compressed data, but when that ends, there is some other binary data. To decompress we need to use the --single-stream
argument to xz
so that it won't label the data corrupt because of this.
$ cat KERNEL.a.xz | xz -d --single-stream > KERNEL.a $ cat KERNEL.b.xz | xz -d --single-stream > KERNEL.b xz: (stdin): Compressed data is corrupt
Looks like the second Magic header was present for some other reason. Perhaps it's part of the decompression engine?
Now we have the uncompressed kernel, we also have the initramfs and the contents of /proc/config.gz
avaliable (inside KERNEL.a
).
$ grep -P -a -b --only-matching $'\x1f\x8b\x08\x00' KERNEL.a 5229342: 6605512: 10308181: $ for i in $(grep -P -a -b --only-matching $'\x1f\x8b\x08\x00' KERNEL.a | cut -d : -f 1); do dd if=KERNEL.a of=KERNEL.a.${i}.gz bs=1 skip=${i}; done 7551598+0 records in 7551598+0 records out 7551598 bytes (7.6 MB) copied, 14.7439 s, 512 kB/s 6175428+0 records in 6175428+0 records out 6175428 bytes (6.2 MB) copied, 11.0656 s, 558 kB/s 2472759+0 records in 2472759+0 records out 2472759 bytes (2.5 MB) copied, 4.82829 s, 512 kB/s $ file KERNEL.a.*.gz KERNEL.a.10308181.gz: gzip compressed data, ASCII, has comment, comment KERNEL.a.5229342.gz: gzip compressed data, ASCII, has CRC, was "", last modified: Tue May 7 14:40:32 2013, max speed KERNEL.a.6605512.gz: gzip compressed data, from Unix, max compression
Looking good... I wonder which is the kernel config?
cat KERNEL.a.6605512.gz | gzip -d | less
And does it support "Root file system on NFS"/CONFIG_ROOT_NFS
(yes) and "IP: kernel level autoconfiguration"/CONFIG_IP_PNP
(yes)?
CONFIG_ROOT_NFS=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y