免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1278 | 回复: 0
打印 上一主题 下一主题

Linux on board: Inside the MediaMVP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-10-13 20:10 |只看该作者 |倒序浏览

By
Peter Seebach
, Freelance 28 Sep 2006
As an MP3 and MPEG player, the Hauppauge MediaMVP lets you play digital media through your television set. As a tightly purposed embedded device, it is an excellent example of a compact Linux implementation on minimal hardware.
Although I've seen smaller embedded Linux systems than the Hauppage MediaMVP, it is the smallest non-handheld, and it's one of the least expensive Linux systems out there. The MediaMVP is similar in some ways to the TiVo: it's intended to be a pure appliance, performing only specified functions. Unlike the TiVo, it doesn't make a significant effort to prevent users from loading their own software, and sure enough, users have done just that. (For more about my look inside the TiVo, read my earlier Linux on board column, "
Blowing the lid off of TiVo
."
This article looks at the "standard" install provided by Hauppage and also looks at the MediaMVP Media Center (MVPMC) project, which is developing a custom user environment for the system.
[Warning: Modifying the MediaMVP as described here or in any other way might render it unusable and will most likely void the manufacturer's warranty. Proceed at your own risk. -Ed.]
In the box
The MVP is an exceptionally compact gizmo. It has even less on-board hardware than the Kuro Box in some ways (see the
Resources
section for articles about the Kuro Box), no Ethernet, and not enough flash to hold a kernel. (Actually, you might be able to fit a kernel in it; they just didn't do it.) The processor is an STBx25xx-series set top controller, which is built around a PowerPC® 405 core. The machine has 32MB of RAM and an Ethernet controller. Some versions also provide wireless capability; mine just has a bunch of soldered-over connectors on the motherboard that could probably have held a CardBus slot. I found a reference on a forum (see
Resources
) to someone who supposedly wired up a serial port, so that might be possible as well. There's also the IR port, which is available to the Linux kernel as /dev/rawir.
The STB processor isn't just a generic PPC405; it has hardware MPEG decoding support built in, which is a good match for a product like this and lets the system move impressive amounts of video and audio without needing a whole lot of processor speed. In short, after all that marketing material you've heard about PowerPC systems being unusually cost-effective and easy to modify to suit given business markets, here's a concrete example. The processor's rated speed is 252 MHz.
The hardware design makes it pretty clear that this is a purpose-built appliance, which is probably why this system costs less than the Kuro Box, let alone a regular computer.


Back to top
Out of the box
Out of the box, the MediaMVP doesn't do anything except look for servers. One way that this system was streamlined was by omitting the large flash storage that would typically be used for a kernel and root file system; instead, the box boots over the network. To avoid clashing with existing netboot servers, the MediaMVP uses non-standard port numbers. The software distributed with the package is a Windows-only server that combines netboot and streaming media services. When the box boots, it gets configuration information and a file named dongle.bin from the server. This file holds a number of things, including a boot loader, a ramdisk image, and a kernel. These can be extracted fairly easily with a little Perl script.
The default setup just sits around talking to the Windows-based server program. The on-disk configuration is, as you might expect, a little interesting. No one will be at all surprised to discover that the system includes a BusyBox install (version 0.60.5). (See
Resources
for a link to more information on BusyBox.) The whole ramdisk contains just over 2MB of files: 686KB for BusyBox, 1191KB for the MediaMVP's userland software, 436KB of kernel modules, and a few small configuration files. This installation is much more stripped down than, say, the fairly elaborate setup of the TiVo.
The setup files are so small it's feasible to reproduce them entirely. The /etc/inittab file is a marvel of compactness:
Listing 1. Contents of /etc/inittab
::sysinit:/etc/rcS
::respawn:-/bin/sh
::respawn:/bin/auto-dongle.sh
#::respawn:/etc/serial_proxy.sh
The serial_proxy program is a trivial script to run netcat on port 4000. It's commented out, and the nc binary has been omitted from the distribution version anyway. The rcS script handles startup tasks, and the auto-dongle script just runs the mpeg decoder. The decoder is simply restarted automatically if it stops; this seems a reasonable choice in context; on a desktop system, you might want to shut a failed service down or emit warnings, but on an embedded box, there's no real point.
The rcS script looks like this, complete with commented-out bits:
Listing 2. The /etc/rcS script
#! /bin/sh
#/bin/umount -a
/bin/mount -a -o rw
# Auto configuration mode
# AUTO=
AUTO=auto-
# ismods for dongle
/etc/insmods.sh
# user state fpage
/usr/bin/fpage >/dev/null 2>&1 &
# set up network
. /etc/${AUTO}netsh.sh
As with the inittab file, the files needed to tweak a configuration option aren't there; there's no plain netsh.sh, only the auto-netsh.sh script is installed. The auto-netsh.sh script tunes some kernel networking parameters, configures the loopback interface, and starts up a DHCP client.
Although my test system has no wireless card, there is at least some support for wireless networking on it already; the "mediamvp" binary (the target for the fpage and mpgdec symbolic links) has lots of strings in it for NWID settings and other 802.11 terminology. This may have to do with the announcement of a wireless-enabled version of the MediaMVP. The support is at least partially in place in the unit I looked at. On a side note, the mediamvp binary wasn't always separate from BusyBox; in very early releases, they were all one binary. This has been a concern for some people, because the mpgdec code has never been released, and BusyBox is GPL'd code.
The bulk of the functionality of this system is hidden, and it seems very likely that a fairly large portion of it actually lives on the Windows side. There's not that much you can do to modify this box without replacing some of the software. Unlike the current TiVo systems, the MediaMVP doesn't make any particular effort to keep you from updating and/or replacing the contents of its file system. So why not do just that?


Back to top
Enter the MVPMC project
The MediaMVP Media Center (MVPMC) project is a complete replacement for the software provided with the MediaMVP. It can obtain video over NFS or from MythTV or ReplayTV servers. Audio can also be obtained over NFS or from a SlimServer server. The software is still in early stages; many features just don't work, or don't work very well. (Part of the problem is the need for the MVMPC developers to reverse engineer the hardware documentation for the controller chip; if the chip's documentation were available to open source developers, the MVMPC developers would have an easier time.) But on the other hand, it has the universal benefit of open source systems: if you want it fixed, you have access to the source.
The boot loader for the MediaMVP still needs to have a dongle.bin file in the canonical format. Furthermore, the kernel modules for the various hardware pieces have to be loaded, and because source for them isn't currently available, they have to be copied in from the old system. However, the procedure has been figured out, and the MVPMC build scripts can generate images with new root file systems and new kernels.
The MVPMC root file system is larger than the stock file system, and not always in a way that makes sense:
Listing 3. Why is this on a ramdisk?
$ ls -ld lost+found
drwx------  2 root  wheel  176128 Feb 10 20:28 lost+found
The BusyBox binary is actually version 1.0, but it comes out smaller than the originally installed version (0.60.5); only about 600KB, despite having more commands linked to it. I'm not sure what caused the extra size in the old one. The system in general has a lot more files on it than originally ship with the MediaMVP; reading between the lines, some of the data files the shipped system uses must either be embedded in executables or passed in from the server. The MVPMC system provides a much more complete collection of shell utilities -- not that they do much, in the absence of a way to log in! However, the MVPMC system shows signs of being intended for debugging; you'd have to add a way to connect, but the hooks are there to poke around once you can log in.
The MVPMC project acquires additional configuration from the server at runtime; corresponding to the dongle.bin file (containing the kernel and file system) that the box downloads, it grabs a dongle.config file, which is simply run by /etc/rcS. Thus, if you want to run telnetd, you can; just add it to your dongle.config.
The ongoing development of this project suggests that, while it's not quite as stable as the originally shipped system yet, it probably will be, and it will certainly have a broader range of features. It's hard to argue with the price, either; the one way to improve on inexpensive hardware is with free (as in beer) software. The obvious limitation is simply that, because the device itself has essentially no expansion options, there's not much you can do with it other than make it play media. Still, the temptation to build a Multiple Arcade Machine Emulator (MAME) platform is there; there are IR-based remotes with decent response time, and the hardware would be an excellent match. It would require some rethinking of the build process, but it could be done.


Back to top
Tiny environments
The MVP is one of the smallest Linux systems you're likely to encounter; in many ways, it has lower hardware specs than handhelds (such as the Zaurus; see my Linux on board column, "
Zaurus pioneers embedded Linux
, and the lack of local storage imposes rigorous demands on the root file system. Other systems can more easily afford to be careless with a couple of megabytes here or there; the MVP really has to work very hard on keeping everything small. Similarly, the very small RAM footprint makes it important to be very careful about memory leaks.
That said, this environment is a comparative cakewalk for Linux. Linux developers have long made a practice of intentionally targeting machines that were dismissed as "too slow" or "too small." It's not unheard of for machines a full decade old to still be in use as servers running modern Linux. As a result, a lot of the hardest work is already done; for instance, Linux is nicely decoupled from any of the variety of bulky user interfaces available for it, and the Linux kernel is nicely modular. Userland is even more adaptable, which matters a lot when you're trying to build a system a little smaller than the gigabyte or so most distributions consume these days.
Of the embedded Linux systems I've worked with, the MediaMVP is probably the one that does the best job of being transparent to regular users who don't know or care what an operating system is and who just want the box to work. On some systems, the OS is a little intrusive; on the MediaMVP, like the TiVo, it's virtually invisible. However, the MediaMVP has embraced the flexibility Linux offers; this is probably because it's sold as a piece of hardware, not as a dongle to let you use a pay service.
To the average end user, the theoretical option of modifying the system is pretty much a complete non-issue: chances are, the majority of TiVo owners have never even considered the question of whether or not there's "some kind of operating system" on their player, and they would not find the benefits of a modified system worth the time and effort it would take to do the modifications. However, for people who do have, for whatever reason, a desire or need to modify things, it's nice to have the option. The openness of the MediaMVP pays big dividends here.
Furthermore, even the users who have no interest in doing modifications may benefit when modifications are freely available; forum threads discussing the MediaMVP include posts from users who clearly don't know what Linux is but are happy to have more options on their video-playing box. From my look inside, the decision to build the system on Linux seems to have paid off substantially; the side-effect of providing what appears to be a nice generic thin client for about a hundred dollars is no doubt pure coincidence.

Resources
Learn

Get products and technologies


  • Order the SEK for Linux
    , a two-DVD set containing the latest IBM trial software for Linux from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
  • With
    IBM trial software
    , available for download directly from developerWorks, build your next development project on Linux.

Discuss

About the author



Peter Seebach has been using computers for years and is gradually becoming acclimated. He still doesn't know why mice need to be cleaned so often, though.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22778/showart_184277.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP