Category Archives: Embedded

USB sound on Alix running Voyage

I thought that using a USB sound card with Linux would be easy, just plug and play, but I was wrong, it seems. Plug­ging in the Ter­ra­tec Aureon Dual USB (ID: 0ccd:0077) that I bought ren­de­red a pro­mi­sing out­put from dmesg and lsusb, and lsmod sho­wed that even rele­vant modu­les were loa­ded. The pro­blem was that mpd and other pro­grams did not find any way to actu­ally out­put sound to any device. They had the firm belief that my system was lac­king any sound card. Maybe I would need some sound rela­ted pac­ka­ges?

aptitude install alsa-base alsaplayer alsaplayer-text alsa-utils

No luck… The mpd con­fi­gu­ra­tion file /etc/mpd.conf see­med mostly con­fu­sing when it came to out­put devices, and the wiki page it refer­red to did not help eit­her. A search with Google on the USB ID was hel­p­ful though, as usual. Some­one with the alias BigRon also had pro­blems with Debian and this Ter­ra­tec USB sound card. The results from his attempts, docu­men­ted with ver­bose out­put, was simi­lar to mine. User bandan’s reply was the begin­ning of the end of my trouble! I had to edit /etc/modprobe.d/alsa-base.conf to com­ment out a line pre­ven­ting USB devices from becoming the first (default) device, sub­sti­tu­ting it for a line with the oppo­site effect.

## Keep snd-usb-audio from beeing loaded as first soundcard<br/> #options snd-usb-audio index=-2

# Fix from,4119,4166<br/>

  1. Allow snd-usb-audio to be loaded as first soundcard options snd-usb-audio index=0

    Now I was at least able to get alsa­mixer to ack­now­ledge the mere existence of a sound rela­ted device, but alas it chose an input only device (most likely my Logi­tech webcam with microp­hone) as the default device even though it cal­led the Ter­ra­tec one default by name. Luc­kily for me the just men­tio­ned forum thread linked to a more sub­stan­tial thread descri­bing the pro­blem in more depth. I added myself and the mpd user to the audio group, to make sure that there would not be any pro­blems with per­mis­sions regar­ding the devices

    addgroup jadler audio addgroup mpd audio

    I was still unable to play anyt­hing (wit­hout expli­citly cho­sing what Alsa refers to as sound card 1). So I kept try­ing the stuff that had worked for the per­son repor­ting in the forum, cre­a­ting an /etc/asound.conf file with basi­cally the same con­tent as sug­ges­ted in the last thread refer­red to above, but chan­ging all refe­rences to hw:0 to hw:1, and from card 0 to card 1. Now mplayer works, but I still can’t get mpd to do its thing.

Alix2d13 — Voyage Linux or Debian Live?

I am not sure whet­her it is cau­sed by the Ubuntu 10.10 amd64 run­ning on my work­sta­tion or on some bug in the Emde­bian pac­kage, but I do have a hard time to get Emde­bian instal­led. I have tried Mul­tistrap, Debootstrap, and Debian Instal­ler, and I have done it on the Alix com­pu­ter using PXE boot, on my work­sta­tion (follo­wed by chroot etc), and on vir­tual machi­nes using qemu/kvm or Vir­tu­al­box, but so far no luck.

All of this makes it less and less attemp­ting to actu­ally install any Emde­bian based Debian, and so I gradu­ally tur­ned back to Voyage Linux. When I was brow­sing the Voyage site I lear­ned about Debian Live, the system that “punkytse” uses to cre­ate the Voyage ima­ges, and also offers for down­load under tha name “Voyage SDK”. So now I am tes­ting Debian Live and try­ing to learn more about it.

The wiki and the manual seems to be a good place to start when lear­ning about Debian Live.

For those inte­res­ted in PC Engi­nes Alix the Alix forum may also be a good source of information.

(I should really find a bet­ter Word­Press theme, I know…)

Installing Linux on PC Engines Alix2d13 (part 2.5)

After publishing I rea­li­zed that I could have sup­plied more infor­ma­tion, and more down­lo­ads, than I did in my pre­vious post.

Here are links to pat­ched ver­sions of Debian netboot.tar.gz (stable/Squeeze, testing/Wheezy and daily build), all down­lo­a­ded and pat­ched today, 2011-05-10:

I have also made a diff file for the stable mod.

What my script does, basi­cally, is this:

  1. Untar the tar­ball and cd to debian-installer/i386/boot-screens/ where all changes are made.

  2. In the file syslinux.cfg (which is actu­ally a file with PXELINUX con­fi­gu­ra­tions) two lines are added:

    1. serial 0 38400—tel­ling PXELINUX to use ttyS0 for I/O (i.e. as console).

    2. con­sole 0—do not try to use any video console

  3. In the files adtxt.cfgrqtxt.cfg and txt.cfg sub­sti­tute any occu­rence of vga=788 for ttyS0,38400n8. This is done in order to tell the ker­nel that:

    1. There is no graphic/video console

    2. The con­sole that should be used is the first serial port, and with the spe­ci­fied settings.

This is a simp­li­fi­ca­tion, since my script also inclu­des a vari­able for the num­ber of the serial port, in case your con­sole is not on ttyS0. I have not inclu­ded any such con­ve­ni­ence regar­ding speed and other set­tings for the serial port chosen.

Installing Linux on PC Engines Alix2d13 (part 2)

I have found it to be quite nice to be able to boot the Alix board over the network using PXE. Using the Debian netboot.tar.gz tar­ball and TFTP I can boot the Debian Instal­ler or a rescue system, and the for­mer lets me install Debian Linux wit­hout phy­si­cally touching the CF.

In order to make net­boot use the serial port as con­sole I have pat­ched the Debian net­boot tar­ball, and I made a script that does all the patching, just for you… :-)

I have tested it with the Debian stable and tes­ting netboot.tar.gz down­lo­a­ded today and it works, and also with the daily snap­shot from Debian installer.

The script will modify the file syslinux.cfg in order to make PXE­Li­nux use the serial port, and the files adtxt.cfg, rqtxt.cfg and txt.cfg to make sure that the Linux ker­nel (actu­ally the Debian instal­ler in this case) also uses the serial port as con­sole. (Look at the script to see the actual changes. You should of course have a look at it before run­ning it, anyway.)

Making my anci­ent Net­gear WGT634U run­ning OpenWRT serve PXE ima­ges was really a no-brainer. In the Services/Dnsmasq page I ente­red the three cho­i­ces shown below, with  the pat­ched net­boot untar­red on a USB stick mounted on /mnt/sda2.

Refe­rences (other that links above):

Some more patching lets me use pre­see­ding too, but more on that anot­her time.

Installing Linux on PC Engines alix2d13 (part 1)

I have been wan­ting to try an Alix SBC from PC Engi­nes for some time now, and 10 days ago I finally did order one.

alix2d13 in case

Tho­rough as I am I chec­ked lots of sites (mostly wit­hin the EU) for pri­ces, ship­ping, avai­la­bi­lity and range of acces­so­ries. In the end I chose to place my order at Gooze.

I had no trouble at all with my order from Gooze, they were very hel­p­ful and kind. I got a mail asking why I had orde­red anten­nas and pig­tails but no wifi card. I explai­ned that I was loo­king for a dual band card, and that I had not seen one in their web shop. Nine minu­tes later I got a reply say­ing that they had a Wist­ron DNMA-92 in stock, and that they would be able to add it to my order and still ship it the same day. Eas­ter holi­days delayed the ship­ping a bit, as expec­ted, but early mor­ning next busi­ness day the pac­kage arri­ved, and my new found fri­ends at Gooze had even mounted the board in the case, the wifi card on the board, and pig­tails and anten­nas where they should be.

I do not hesi­tate to recom­mend Gooze for anyone loo­king for an Alix system. They also have some use­ful tuto­ri­als on their site regar­ding Alix-iana, and even more on smartcards and secu­rity. (Their site inspi­red me to order a smartcard rea­der with Linux sup­port, the Fei­tian R-310, and a blank smartcard, Fei­tian PKI, for­merly known as Fei­tian FTCOS / PK-01C.

On a side note, I actu­ally pla­ced my order at 14:50 on Wed­nes­day  April 20. Gooze pro­mise that orders pla­ced before 15:00 will be ship­ped the same day, so when my order sta­tus had not changed the next day I wrote to them and poli­tely asked if the order sta­tus update was slow or if somet­hing else had hap­pened. I also made it clear that I was not at all in a hurry and had no pro­blem wai­ting for my stuff. Wit­hin minu­tes Jean-Michel Pouré of Gooze wrote back to me explai­ning that the entire staff had been to Lon­don for a day on a busi­ness trip. He apo­lo­gi­zed and pro­mi­sed to add anot­her smart card to my order at no extra cost. I had not expec­ted anyt­hing like that, and I would have been quite happy just to know that my order had arri­ved and would be ship­ped some day. That is really a good way to make happy (and retur­ning) customers.

Cur­rently I am try­ing to find the “per­fect” way to install Linux on this little gem, most likely Debian in some form. I have tried Voyage, a custo­mi­zed Debian for embed­ded plat­forms with expli­cit sup­port for Alix boards (inclu­ding the three front panel LED’s and the tem­pe­ra­ture sen­sors), and I think it might be good for a system as this one I would pre­fer to know what custo­mi­za­tions are made and why. I would be more com­for­table set­ting up the system myself from the ground up.

Gooze has a few nice howto’s on Alix stuff, and I also tested the Debian instal­la­tion sug­ges­ted. They sug­ges­ted instal­ling the net­boot tar­ball to a CF par­ti­tion, boot from this and using the Debian Instal­ler to install the latest stable ver­sion (Sque­eze). This went fine, but I ended up with a system that felt a bit too blo­a­ted, con­si­de­ring that it is embed­ded. Docu­men­ta­tion and man-pages are fine, but I feel no despe­rate need to waste a lot of flash memo­ryon an embed­ded system for it. When I need docu­men­ta­tion I can use my work­sta­tion or the web.

A con­cept that appe­als to me more is the Emde­bian pro­ject, pro­per Debian adap­ted for embed­ded systems. The idea is right, the docu­men­ta­tion sucks (or I am not able to find it). The Emde­bian fla­vor Grip seems to be about mini­mi­zing depen­den­cies to an abso­lute mini­mum, and also strip­ping docu­men­ta­tion from pac­ka­ges. They pro­cess the actual Debian pac­ka­ges, remove unne­ces­sary parts and repack them. You would nor­mally have both Emde­bian and clas­sic Debian repo­si­to­ries, so that pac­ka­ges that are not yet Emdebianized/Grip:ed will be pul­led from the nor­mal Debian repositories.

This sounds like the best of two worlds, the most com­mon 10 % of the Debian pac­ka­ges are avai­lable from Emde­bian, being smal­ler and having less depen­den­cies, and anyt­hing I want from the remai­ning 90 % is still avai­lable for instal­la­tion. I suspect that any vanilla pac­ka­ges that I install will be “upgra­ded” to Emde­bian style if they are con­ver­ted in the future.

But my cur­rent self impo­sed task is to work out a good (or “per­fect”) way to install a basic Emde­bian system to use as a start for my custo­mi­za­tions. The Emde­bian site recom­mends a tool cal­led mul­tistrap, being somewhat simi­lar to but dif­fe­rent from debootstrap. It will cre­ate a basic rootfs, but there is not a lot of infor­ma­tion on how to pro­ceed to a boo­table CF image. I have found some tuto­ri­als using debootstrap, but I am not sure if they apply since the tools work in dif­fe­rent ways. I will get back about this soon, I think.

Lastly, I tested OpenWRT too, that I have run­ning on my cur­rent router/firewall etc (an anci­ent Net­gear WGT634U). My first attempt at com­piling an image for Alix did not work out (though OpenWRT does have expli­cit sup­port for Alix), pro­bably some miscon­fi­gu­ra­tion on my side, but I tested with a plain x86 image that I down­lo­a­ded, it worked just fine, and com­pa­red to all other Linu­ces I tested this one was defi­ni­tely the fas­test! It boots in maybe 20 – 40 % of the time the others need, and system shut­down is even fas­ter rela­tive to the com­pe­ti­tion. It does not have the back­bone of the huge Debian com­mu­nity, but the sheer speed of it still makes it inte­re­s­ting as an alternative.