A build system for MiniMyth and debugging bzImage/cramfs

Announce/Discuss projects you are working on for MiniMyth

Moderator: Pablo

mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

A build system for MiniMyth and debugging bzImage/cramfs

Post by mjhammel »

I decided to look at trying to build a complete MiniMyth system from the ground up based on Larry's article for the core system and the current MiniMyth layout. The current goal is to recreate MiniMyth 0.5.1 but with a 2.6 kernel. I've written a perl script that will generate a Debian build environment (w/debootstrap) on a RedHat (re: rpm based) system and then build the kernel, XFree86 w/Unichrome patch, devfs, telnet/ftp, and various other bits. The usage statement looks like this:

Code: Select all

./mkminimyth.pl [ --clean | -d | --<section> | --help | -h
where
--clean     Clean up the build environment
--clobber   Clean up and remove local archive copies
-d          Debug mode: saves downloaded archives and reuses them
                                                                                
Sections to build:
all      Builds everything
base     Creates the debian build environment
busybox  Builds BusyBox inside the base
kernel   Builds a kernel inside the base
audio    Builds the Viaudiocombo package inside the base
         (only for 2.4 kernels, however)
devfs    Builds the devfs driver for the given kernel
xfree86  Builds XFree86/Unichrome from source in the base
config   Copies in the config files into the ROOTFS
utils    Builds utilities like telnet, ftp, etc.
myth     Builds MythTV
video    Builds the configured video player (mplayer, VeXP, etc.)
sensors  Builds the LMSensors package in the base
pkg      Packages everything into the bits needed for PXE booting
The Myth, video, and sensors sections are not implemented yet.

Mostly I'm doing this out of curiosity but partly because I wanted to try and solve the 6-channel audio issue and that meant building a new kernel based on 2.6. So that's where I'm at now. Building all the rest of the pieces just seemed like a useful project to reproduce the package as a whole when needed. If anyone would like to help me with this project, let me know. I'll be wrapping the build script inside of a Makefile in the long run (for ease of use).

The problem right now is that while the build works fine, the generated bzImage/rootfs don't boot. I'm missing a kernel configuration item somewhere. When the kernel boots and loads the cramfs image I get as far as loading the RAMDISK. Then I get this error:

Code: Select all

RAMDISK: cramfs filesystem found at block 0
RAMDISK: Loading 7508 block [1 disk] into ram disk ... done.
UDF-fs: No VRS found
Kernel Panic: VFS: Unable to mount root fs on unknown-block(0,0)

I thought the (x,x) should mean major/minor block device number, but what device is 0,0? Am I missing something in the "Append" line of my PXE default file? Does the UDF line have any impact on this - isn't UDF a filesystem for CD/DVD's?

The following config items, which I think are relevant, are configured for the 2.6 kernel:

CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_DEVFS_FS=y
CONFIG_DEVFS_MOUNT=y
CONFIG_TMPFS=y
CONFIG_RAMFS=y
CONFIG_CRAMFS=y

Anyone have any ideas on what else I might be missing? I can post the complete config file if anyone wants to see it, or email it privately.
The Graphics Muse
mjacob
New Member
Posts: 6
Joined: Thu Apr 15, 2004 9:20 pm
Location: San Diego, CA
Contact:

Post by mjacob »

Silly question, but have you verified that your ramdisk size kernel parameter is sufficient for the rootfs image that you've created?
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

Post by mjhammel »

mjacob wrote:Silly question, but have you verified that your ramdisk size kernel parameter is sufficient for the rootfs image that you've created?
Yes. I've actually got it running now and am well on my way to getting MiniMyth running with my own version of the rootfs. The original cramfs problem was a number of things. One thing I found was that the 2.6 kernel specified a 4100 block size for cramfs instead of 4096 in the kernel. But I'm not currently working with 2.6 - I'm getting 2.4 up and running first, then I'll move on to 2.6.

Right now the build system is working well to get the epia kernel, base filesystem, Unichrome/XFree86, translucency, mysql, devfs, and various other parts all put together. I'm working on cleaning up the init scripts now. MythTV doesn't start yet - I think because of a missing /root directory. I'm working on that tonight. Once MythTV starts and runs I can finally attack the original problem - getting amixer working with the viaudiocombo driver. Hard to test that until I have some 6 channel audio to listen too. :-)

The thing that makes this easy is starting with debootstrap as the basis for the system. By doing that I can build this on any distribution and reuse the work already done in packaging much of the prerequisite bits, like mysql and mythtv. That leaves me free to focus on hardware specifics in the kernel.

BTW, I looked at GAR after I started this. I think it does essentially what my perl script is doing but in a more "make" like fashion. I'm sure its more flexible too, though more complex (since it tries to be a more generalized solution). I wouldn't mind converting to it but the effort extended so far makes me want to finish the perl version first.
The Graphics Muse
mjacob
New Member
Posts: 6
Joined: Thu Apr 15, 2004 9:20 pm
Location: San Diego, CA
Contact:

Post by mjacob »

I've done a lot of the same stuff for the sake of customizing... not to mention that I wanted to see if the unichrome drivers were viable. I'd be interested in wether or not you're able to get mythtv up and running. I've tried with both 0.16 and 0.15.1, and both versions segfault shortly after startup. Without a viable debugging environment on the diskless system, I'm unable to determine the cause. Right now I'm building a disk based EPIA system for the sake of figuring out the crash.
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

debugging a build

Post by mjhammel »

strace is available in busybox, I believe. I used that to figure out what bits were missing and causing MythTV to not start. And if that doesn't work you might be a be able to copy your systems strace to a mounted directory, provided your rootfs has the correct libs.

I was missing an /etc/fonts directory for fontconfig and my /root was not being creating properly last night. That's all taken care of. I left off last night with mythfrontend not opening the mysql.txt file properly. Its out there, but maybe not in the location mythfrontend is looking for it. I'll fix that tonight I hope (if tropical storm Ivan doesn't make a mess of things).

I mount /mnt/store and /mnt/bin by default in my builds, the former for data (where I also keep strace output while debugging) and the latter for extra tools for debugging after the system is up . Interestingly, I never was able to get a decent window manager built. I wanted fluxbox but it wouldn't build. Its not a necessary component for debugging so I'm not wasting time on it right now.

strace won't point to a bit of code on the segfault but might give you some idea what the application was trying to do at the time.
The Graphics Muse
lmatter
Contributor
Posts: 632
Joined: Sat Aug 23, 2003 5:13 pm
Location: California, USA

Post by lmatter »

How is this effort going?

I've been fumbling around with various "roll your own distro" methods for a bit now and haven't found one that strikes me as easy to use.

My constraint is that I generally get small, 10-15 minute windows of play time so If I can't figure something out quickly I usually just drop it.

GAR - can't get gcc to build, though I still am fond of it.
emDebian - set one of my EPIA's up with debian so I can play with stag (http://stag.mind.be/) but I am still learning how apt-get, dpkg, et. al. work.
gentoo - still have a bad taste in my mouth from the last attempt.

Looks like your system uses perl, which I have never bothered to learn. I saw on your website that you were having problems with subversion.

When I get something worth releasing, I am planning to use perforce (http://www.perforce.com) for my source code control. I have managed to get a free open source license for 10 contributors (unlimited anonymous readonly access).

So, perhaps we could work together; I could host the source (perforce.linpvr.org) if you like. If you would rather work on your own that is fine with me too. Let me know.

Larry[/url]
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

The build system

Post by mjhammel »

lmatter wrote:How is this effort going?
Good. I have a system that comes up in MythTV but my backend appears to be mucked up because TV viewing is showing weird colors - almost like reverse video but not quite. There are still quite a few issues to work out to make the image work as well as yours, but the build system is looking pretty solid. In fact, I was just cleaning up my web site to put up a project page for the build system to start getting some feedback on it.
I've been fumbling around with various "roll your own distro" methods for a bit now and haven't found one that strikes me as easy to use.
The problem with a build system for distros is that the requirements are very distro specific so a generalized solution is often difficult to create. GAR has some great ideas, but honestly seems like overkill for what MiniMyth tries to produce. Then again, maybe I'm not thinking long term enough for where the project might be in, say, 2 years.
emDebian - set one of my EPIA's up with debian so I can play with stag (http://stag.mind.be/) but I am still learning how apt-get, dpkg, et. al. work.
Dpkg is good but a little clunky to use. We use it at work quite extensively for packaging our product. That's my job - build master. All things considered, I'd rather be writing code. But someones gotta do it. :-)
Looks like your system uses perl, which I have never bothered to learn. I saw on your website that you were having problems with subversion.
Yep. Perl turned out to be pretty easy to learn, even for an old fart like me. PHP too. But Perl is well suited for tasks like this because of its good at parsing data strings, and build systems use lots of configuration files.

Subversion I like in principal but I kept having authorization problems. As far as I could tell I'd done everything right. I tend not to spend too much time on something if the most basic features take me too long to get working. So I'm falling back to CVS, which is just about set up now.
When I get something worth releasing, I am planning to use perforce (http://www.perforce.com) for my source code control. I have managed to get a free open source license for 10 contributors (unlimited anonymous readonly access).
I've used Perforce before. It's not bad but I can't say it provided any big benefits over open source source control systems. There were a couple of minor things I liked, but its been a couple of years since I used it - can't remember what they were off hand.
So, perhaps we could work together; I could host the source (perforce.linpvr.org) if you like. If you would rather work on your own that is fine with me too. Let me know.
That'd be great! I'd love to be able to contribute to the project. I'm think my build environment will help initially to recreate consistant builds and maybe in the long run we'll convert to something more suitable (than a perl script, that is). I'll probably still put a page on XEUS up to describe the build system but I'll have it point to the main project page at linpvr for active development issues.

How do you want me to make the build environment available? Tarball from my site? Or do you have somewhere you'd like me to upload it to? Email is possible, but I don't remember how big the tarball is (sans downloaded packages, which it can keep in a local archive when requested).
The Graphics Muse
lmatter
Contributor
Posts: 632
Joined: Sat Aug 23, 2003 5:13 pm
Location: California, USA

Post by lmatter »

I'm pretty determined to use perforce for my part of it. I've used it for the last 10 years and I'm quite used to it. I don't want to debate source code control here.

I would like to take a look at your work and see how quickly I can come up to speed on it . I would like to check it into my perforce repository and work on it from there. I'm assuming all the work you did is opensource-ish.

I would be really happy if we all used that repository. I can set you up with an account and you can check in your tree, or you can shoot me a tarball and I'll populate the repository. Let me know if you're ok with this.

In a nutshell here is my current plan for minimyth (changes daily :-)
  • build from source into an NFS root
    include all myth modules (no controversial code, like dvd decryption though)
    allow it to be booted from cd, CF, whatever
    support other multimedia functions (VideoLAN?)
    focus on set top box functionality on EPIA hardware
    super-short startup with bootsplash
    diskless slave support
    support other devices (webcam, digital camera download, etc.)
In short, I am focused on a high quality set-top box application. I'm not interested in supporting anything that requires a keyboard, for example.

Thanks,
Larry
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

Post by mjhammel »

lmatter wrote:I'm assuming all the work you did is opensource-ish.
Yes. I'd like to license it with the BSD or MIT license if possible.
I can set you up with an account and you can check in your tree, or you can shoot me a tarball and I'll populate the repository. Let me know if you're ok with this.
That's fine. I'd rather check it in myself so I know I can access it. Where do I get the clients?

From your list:
  • build from source into an NFS root - this is essentially done in the build tools.
    include all myth modules (no controversial code, like dvd decryption though) - not done, only MythTV is included currently but the others are easy enough to add.
    allow it to be booted from cd, CF, whatever - that will be a little different than what happens now because you need a bootloader along with the kernel and ramdisk
    support other multimedia functions (VideoLAN?) - user level stuff is easy enough to add
    focus on set top box functionality on EPIA hardware - I like this bit of focus because generalizing hardware support may make the runtime system grow too fast.
    super-short startup with bootsplash - I did bootsplash with Morphix at work and it was on my todo list for the build system anyway
    diskless slave support - isn't that what minimyth is now?
    support other devices (webcam, digital camera download, etc.)
Most of what you're planning is easy enough to add to the build system. I got the kinks worked out (I hope) the last time I worked on it (about 2 weeks ago - had an article to get out after that) to allow you to build sections separately from building the deliverables (kernel and cramfs together) and to be able to rebuild the deliverables or rebuild the binaries from source at any time. There is probably more work to be done in that area, though, so its easy to redo what you want when you need to.
In short, I am focused on a high quality set-top box application. I'm not interested in supporting anything that requires a keyboard, for example.
Sounds good to me. I tried to build an IR receiver for my MiniMyth client a while back and failed. A guy at work told me I soldered the components in backwards. *sigh* But I had it working on the server using the WinTV PVR 250 IR receiver.

So just tell me how to get the perforce client and I'll get the build tools checked in. After that you'll probably want (after learning how to use it) to tell me whats missing to get it back to the level of production you have with the current minimyth release.

And I gotta get myserver running correctly again. I'd like to just apt-get remove the packages but I'm a little afraid that the packages I'd get with apt-get install will not be 0.15.1 but 0.16 instead. I haven't checked what the apt repositories are serving up currently.
The Graphics Muse
lmatter
Contributor
Posts: 632
Joined: Sat Aug 23, 2003 5:13 pm
Location: California, USA

Post by lmatter »

Perforce client for i386 (2.4 kernel) is here:
http://www.perforce.com/perforce/downlo ... 24x86.html

Anyone should be able to access the repository on perforce.linpvr.org:1666 as the anonymous user (formal announcement and instructions to follow after it is set up, but PM me if you want to tinker early).

I'll send you an email with contributor instructions. We can talk about the license then too.

Larry
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

build system checked in

Post by mjhammel »

Okay, I've checked in the build system. There is a readme file in the top level that should get you some idea on how to use it, but feel free to let me know if you have any questions.

There should be a TODO file in there too, but it's essentially blank. We'll just use that to track things for now.
The Graphics Muse
mjacob
New Member
Posts: 6
Joined: Thu Apr 15, 2004 9:20 pm
Location: San Diego, CA
Contact:

Re: debugging a build

Post by mjacob »

mjhammel wrote:strace won't point to a bit of code on the segfault but might give you some idea what the application was trying to do at the time.
strace didn't do the trick for me. :( I forget what the problem ended up being... but it was really annoying.

I've gotten my frontend up and running stable with:

vanilla 2.4.27 kernel
XFree86-4.4.0
Open Source Unichrome drivers
mythtv-cvs snapshot (shortly after 0.16 release)
mythvideo
mythweather
mythnews
MPlayer-1.0pre5
QT-3.3.3
NFS/cramfs boot

The whole thing has gotten pretty heavy with the compressed rootfs consuming 48 MB. When running via NFS the UI response can get a little sluggish, but the boot itself is wicked quick.

You wouldn't happen to know how to cut the fat out of XFree86?

I'm working on building mythbrowser, but since it requires KDE I'm afraid that it will absolutely require a NFS based root filesystem. I haven't touched mythmusic, but that should be a trivial task.

I did the whole thing with a simple bash script, so it probably doesn't hold a candle to the build system you've put together. Does your build system require that you build from an EPIA box, or can you cross-compile everything with a fast machine? If you do allow cross-compiling, to what extent to you build from source? I currently cross compile, and the biggest problem that I ran into was trying to use the i686 optimized libc libraries that come with the distro instead of building glibc from source.
mjhammel
Member
Posts: 31
Joined: Wed Aug 25, 2004 3:54 am
Location: Colorado Springs, CO
Contact:

Re: debugging a build

Post by mjhammel »

You wouldn't happen to know how to cut the fat out of XFree86?
Not yet, but I'm not to the point of trimming fat in the build system. You can run strip on the binaries to reduce their sizes a bit. I'm not sure if that works on libraries, however.
Does your build system require that you build from an EPIA box, or can you cross-compile everything with a fast machine?
The build system currently requires that you build on the same box you built your Myth server (re: backend) on. In fact, you should probably build the backend and front end on the server first, make sure it works, then proceed with the build system for minimyth.
If you do allow cross-compiling, to what extent to you build from source?
The kernel doesn't require "cross compiling" since both my server and the EPIA are x86 based and you can tell the kernel build what platform to build for anyway. There will be tweaks in the long term to optimize for EPIA (some of which are already in place).
I currently cross compile, and the biggest problem that I ran into was trying to use the i686 optimized libc libraries that come with the distro instead of building glibc from source.
I"m not sure I understand this issue. I know that after I build binaries that go into the rootfs I copy over the dependent libraries for that binary from the build system. The build script can automatically determine what those dependencies are. The hard part was that on the RH9 system I'm on there are multiple copies of libc under /lib. I honestly can't remember how I solved that, though I think I have a list of libraries that don't resolve automatically and are listed in a "manual" list of libaries to copy into the rootfs.

Anyway, the build system has a bit of evolution to go through. Hopefully Larry can help me get it back to the quality he had with his original distribution, then we can tweak it for size, platform specifics, and various other things.
The Graphics Muse
mjacob
New Member
Posts: 6
Joined: Thu Apr 15, 2004 9:20 pm
Location: San Diego, CA
Contact:

Re: debugging a build

Post by mjacob »

mjhammel wrote:
I"m not sure I understand this issue. I know that after I build binaries that go into the rootfs I copy over the dependent libraries for that binary from the build system. The build script can automatically determine what those dependencies are. The hard part was that on the RH9 system I'm on there are multiple copies of libc under /lib. I honestly can't remember how I solved that, though I think I have a list of libraries that don't resolve automatically and are listed in a "manual" list of libaries to copy into the rootfs.
The problem is that most distros install different versions of libc, and other libraries, based on the processor type. I build everything on an i686 box right now and this works fine with EPIAM10k based frontends. Trying the exact same rootfs that works on the M10k but running it on a M6k frontend causes infinite reboots or a hang at boot time. I ended up having to build XFree86 and glibc for i386 in order to get it to work on a M6k box.
shinysteve
Contributor
Posts: 64
Joined: Fri Apr 09, 2004 5:45 pm
Location: Bonn, Germany
Contact:

Post by shinysteve »

Just had a pop at the perforce SCCS. Nice one.

And doubly nice is the perl script from mjhammel.
I've been building minimyth lot lately while trying to re-create my working spdif version and I keep running into problems with my low-quality build env.

I'm having a go at building as I write this. Will feedback if required.

Regards

Steve.
Post Reply