Linux & Other Good Stuff

Notes, Reviews & Configuration of Linux, GP2X & Pandora
RSS icon Email icon Home icon
  • Setting up a C++ Development Environment on the Pandora

    Posted on June 24th, 2010 bill No comments

    I wanted to setup the Pandora so I could develop C++ program directly on the unit rather than using a cross compiler, I am also installing the SDL & OpenGL ES libraries. Until a PND package is produced this is what I have done to install the development libraries. You need to use a terminal to issue the following commands and then either issue these commands prefixed by ’sudo’ or login as root using su.

    opkg update

    Update is important to do first to make sure the package lists are up to date. Under no circumstances do a “opkg upgrade”, trust me on this. If you do be ready to do a firmware reflash.

    opkg install gcc gcc-symlinks gcc-doc make make-dev binutils-dev
    opkg install cpp cpp-symlinks
    opkg install g++ g++-symlinks libstdc++-dev
    opkg install libgles-omap3-dev
    opkg install libsdl-1.2-dev libsdl-gfx-dev libsdl-image-1.2-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev

    OK, this is the tricky one, OpenPandora have patched the libsdl-mixer library, so there is no equivalent “-dev” library, for the mean time I am forcing the installation of the Angstrom library, you will notice the “–nodeps” flag. So far I haven’t seen any problems with doing this, your milage may vary. I will be coding an application that uses sound (portable music player) so we’ll see how it goes.

    opkg –nodeps install libsdl-mixer-1.2-dev

    You can write your code using ‘nano’ or ‘vi’ in the console or use the gui application ‘Mousepad’. I suggest creating a directory for programming on your SD card. Then in a console you can compile and run your applications. In a follow up post I will show how to write a “Hello World” program on the Pandora using some SDL and C++.

    Have Fun :)

  • NIS/NFS Networking with Mandriva 2010

    Posted on March 9th, 2010 bill 1 comment

    I recently setup a netwoNIS/NFS Networkingrk using NIS & NFS with Mandriva Linux (Running KDE) as the server and workstation OS.  I chose to have Linux installed on each workstation (rather than using LTSP), as the machines are reasonable in specifications.

    When completed the workstations now show the list of users on the login screen.  Users can login to any of the workstations and get their desktop complete with all their settings (background, themes, email setup, etc).  This makes for a very flexible setup where if one workstation fails the user can simply logon somewhere else until the workstation is fixed.  It also means that all user data and configuration is stored centrally on the server.

    Server Setup

    These instruction refer specifically to Mandriva 2010 (or Mandriva 2009) but the setup would be very similar for other Linux flavours. You should open a console as root or su to root to issue these commands.  I use ‘vi’ to edit the configuration files but you could also use ‘nano’ or ”kwrite’ if you like.

    Install the packages:  ‘ypserv’ and ‘rpcbind’ (or ‘portmap’ for Mandriva 2009).

    urpmi ypserv rpcbind

    Make sure that the services are set to start on bootup :-

    chkconfig –level 345 ypserv on
    chkconfig –level 345 rpcbind on  (or portmap for Mandriva 2009)

    Set the domain name (not the internet domain name, just the NIS domain name used internally). I just used “server” for simplicity :-

    Add “NISDOMAIN=server” to the end of the “/etc/sysconfig/network” file.
    Issue the command “domainname server”

    (Note that I do both of the above as I noticed that just using the domainname command worked but seemed to be forgotten later.  To check that your domainname is still set just issue the “domainname” command with no parameters).

    Make the user home directory mount point. I use /export/home rather than /home to save confusion later on :-

    mkdir -p /export
    mkdir /export/home

    If you have existing accounts in /home on the server that you wish to move to  /export/home :-

    mv /home/fred /export/home  (Move Fred’s account)

    For all moved users edit the /etc/passwd to set the new path.  Note that I set all “exported” user ids to 600 or over so that we can selectively export only the users over 600 and excude the local users from 500 to 599 :-

    ie. fred:x:600:600:Fred Flintstone:/export/home/fred:/bin/bash

    Create (or add to) the /etc/exports file.  The following example assumes you are using the 192.168.1.x network.  The first line exports the home directories of all users, the following optional lines show how to export a few other shared directories if needed  :-

    /export 192.168.1.0/24(rw,no_root_squash,no_subtree_check,sync)
    /data/public *(no_all_squash,sync,secure,rw)
    /data/office *(no_all_squash,sync,secure,rw)
    /data/admin *(no_all_squash,sync,secure,rw)

    Make the NIS maps.  This also needs to be run after adding, changing or removing users.  Note that I set MINUID and MINGID to 600 in the /var/yp/MakeFile so that users 500 to 599 are not shown :-

    cd /var/yp
    make

    That’s the server configuration complete.  You can now add new users if required, when adding them set their home directory to /export/home/{username} (you may need to mkdir the directory before adding the user) and their userid/groupid to 600+.  You can now either start the required services (ypserv, rpcbind, portmap) or just restart the server and you’re ready to go.

    Client Setup

    Install the packages ‘ypbind’, ‘autofs’ and ‘rpcbind’ (or ‘portmap’ for Mandriva 2009).

    urpmi ypbind autofs rpcbind

    Make sure that the services are set to start on bootup :-

    chkconfig –level 345 ypbind on
    chkconfig –level 345 autofs on
    chkconfig –level 345 rpcbind on  (or portmap for Mandriva 2009)

    Set the domain name (not the internet domain name, just the NIS domain name used internally). I just used “server” for simplicity :-

    Add “NISDOMAIN=server” to the end of the “/etc/sysconfig/network” file.
    Issue the command “domainname server”

    Add nis to the following entries in /etc/nsswitch.conf as follows

    passwd:    nis files
    shadow:    nis files
    group:    nis files
    automount: files nis

    Add to end of /etc/yp.conf

    ypserver 192.168.1.2  (Use your servers IP address here)

    Add to end of /etc/autofs/auto.master

    /export auto.export –timeout 30

    Create auto.export with

    home -fstype=nfs,rsize=8192,wsize=8192,nosuid,nolock 192.168.0.2:/export/home

    mkdir -p /export

    Switch off auto-login (if enabled) in Control Centre.

    (I will cleanup and clarify the workstation configuration soon).

  • Mandriva 2010.0 and Cedega CD/DVD Detection

    Posted on November 29th, 2009 bill 3 comments

    Cedega Logo

    Having recently upgraded to Mandriva 2010.0, I also wanted to give Cedega a go, so I loaded up the latest Cedega and found that certain CDs and DVDs were not recognised. They would load OK but would not run, failing the “copy-protection” test in Cedega Diagnostics.  The game in this case was Oblivion which installed fine but would not run.

    I found that I had to manually add an entry to the end of  /etc/fstab file, to specifically set the CD/DVD options.

    # Entry added to allow Cedega copy-protection test to work.
    /dev/sr0 /mnt/cdrom iso9660 user,unhide,noauto,ro 0 0

    You will need to replace “/dev/sr0″ with the actual location of your CD/DVD drive.  You can check where the /dev/cdrom and /dev/dvd links point to get this information.  I’d imagine that in most cases “sr0″ will be correct.

    Strangely enough the same setup on a notebook worked perfectly without any changes to the fstab file.  So it’s obviously only certain hardware configurations that need this change.

  • TRS-80 Emulator for Linux

    Posted on January 27th, 2009 bill 1 comment

    I got a little nostalgic when my son started writing a game in Fenix that looked a lot like Robot Attack (Even though he’s never seen it). So I thought I’d show him the original, but rather than try and setup the old System 80 (TRS-80 clone from DSE) I decided to use an emulator.

    I’ve used Tim Mann’s excellent TRS-80 emulator xtrs before which I remember worked well. Unfortunately when trying this now it seems that Linux has evolved a fair bit and as a result I noticed a few issues running xtrs.

    - xtrs would not work on my new distro without removing the -DHAVE_SIGIO from the makefile. (See Tim’s page for details on this).
    - Sound on xtrs would not work unless I stopped or removed the pulseaudio process.
    - To allow -autodelay to work on xtrs I had to remove the optimizations from the compiler (-O0).
    - Keyboard input tends to be flakey on newer distros also.

    After a little research I came across sdltrs which is based on xtrs. The benefit of using the sdl version is that it works around the problems associated with new linux distros. Many thanks to Mark Grebe for his work on this.

    So here’s a summary of what I did to get sdltrs running…

    - Download the tarball from the Browse SVN under the Code menu
    - Extract the tarball “tar zxvf src.tar.gz”
    - cd src, cd linux, make
    - this will create a sdltrs binary file, you just need to execute this. enter ./sdltrs
    - I created a new directory with sdltrs, the level2.rom file and various disk files.
    - Once sdltrs has booted the level2.rom press F7 for configuration options.
    - Put a disk operating system into the Disk 1 slot (ie NEWDOS 80)

    - Press F10 to reset the system and it should boot the disk.
    - For those a little rusty like me try “DIR :1″ to show contents of disk 2.

    Works Great :)

  • Wireless LED on Notebooks

    Posted on December 30th, 2007 bill No comments

    Having just installed Mandriva Powerpack 2008 (and it is very good by the way, you can buy it at http://www.dt.com.au ), I found that all the hardware of my notebook was automatically identified and worked perfectly. With the exception of the wireless LED. I have the Intel Centrino using the ipw2200 driver, the wireless works perfectly but the LED according to the documentation is an experimental option.

    In order to activate it I only had to add the line “options ipw2200 led=1″ to the /etc/modprobe.conf file. I used “vi” in order to do this (you need to have root priviledges). Alternatively if you want a graphical way to do it go into “Configure your Computer”, its on the quick launch bar in Mandriva 2008, select “Hardware”, the “Browse and Configure Hardware”, the hardware list will then be compiled and displayed.

    In the list you should find a category called “Ethernet Card” and as a sub-category to that you will see your wireless card listed (something like “PRO/Wireless 2915ABG” or similar). Select the card and in the right hand windows click on “Set current driver options”. The windows that comes up will show all the parameters to the ipw2200 driver, scroll down to find the “led” parameter and enter “1″ into the textbox. Click “OK” to save. You can then exit the control centre. You will probably need to reboot to activate the LED function. Even though the LED option is experimental it seems to work fine for me.

    I would appreciate your feedback if you have comments, corrections or additions to this article, Thanks.

  • Setting up Notebook Hotkeys

    Posted on July 27th, 2007 bill No comments

    I recently setup the hotkeys on my notebook in Mandriva 2007 running KDE. It is fairly simple to do and consists of one script file and then appropriate entries in “Keyboard Shortcuts”.

    I created the following file called “command-shortcuts” and placed it in the “bin” directory in my home directory. Make sure to make it executable using “chmod +x command-shortcuts”.

    #!/bin/sh

    xmodmap -e “keycode 176 = F20″ # Volume up
    xmodmap -e “keycode 174 = F21″ # Volume down
    xmodmap -e “keycode 160 = F22″ # Mute volume
    xmodmap -e “keycode 178 = F23″ # Mail hotkey
    xmodmap -e “keycode 236 = F24″ # Web hotkey
    xmodmap -e “keycode 162 = F25″ # Play / Pause
    xmodmap -e “keycode 164 = F26″ # Stop
    xmodmap -e “keycode 144 = F27″ # Previous Track
    xmodmap -e “keycode 153 = F28″ # Next Track
    xmodmap -e “keycode 115 = F29″ # Win
    xmodmap -e “keycode 117 = F30″ # Menu
    xmodmap -e “keycode 223 = F31″ # Sleep

    The keycodes should work for many notebooks. To check they are right for your notebook you can run the ‘xev’ command in a console. The keycode will be displayed for each key you press.

    So that the keycodes get loaded at each login, add “/home/[username]/bin/command-shortcuts” to the end of your “.bashrc” file. Replace [username] with your login name.

    Now launch “Keyboard Shortcuts” from the “System”, “Conifguration”, “KDE”, “Regional & Accessibility” Menu. Here using the “Command Shortcuts” tab you can assign the “Mail” and “Web” Keys. Using the “Shortcut Schemes” you can assign the the “Win”, “Menu” & “Sleep” Keys. I set the “Win” key to switch to the next desktop, the “Menu” key brings up the KDE Menu and the “Sleep” key issue the logout command.

    Finally you can setup the Volume Down, Up and Mute by right-clicking on the Mixer and selecting “Show Mixer Windows”. Then from the “Settings” menu select “Global Shortcuts” and assign the appropriate keys. You can do the same in Amarok for the “Play/Pause”, “Stop”, “Previous Track”, “Next Track”.

    Thanks go to Ubuntu user zba78 who posted info on hotkeys at http://ubuntuforums.org/showthread.php?p=1260079.

    I would appreciate your feedback if you have comments, corrections or additions to this article, Thanks.

  • Using nVidia Twinview and mplayer

    Posted on June 10th, 2007 bill No comments

    I recently setup a second monitor and then managed to use it to display video whilst still working on my main monitor as usual…

    Here are the main settings to add to your xorg.conf file. In the “Screen” Section Add..

    Option “MetaModes” “1024×768,1280×800″
    Option “TwinView”
    Option “TwinViewOrientation” “DFP-0 LeftOf CRT-0″
    Option “TwinViewXineramaInfoOrder” “DFP-0, CRT-0″

    To find the id’s of your monitors look at the /var/log/xorg.0.log file. I reversed the order of the screens using “TwinViewXineramaInfoOrder” and placed CRT-0 to the right of DFP-0 with “TwinViewOrientation”.

    To play a video file on either screen you specify the “-xineramascreen” parameter with “0″ or “1″. An example…

    mplayer -aspect 16:9 -stop-xscreensaver -xineramascreen 0 video-file-1.avi

    mplayer -aspect 16:9 -stop-xscreensaver -xineramascreen 1 video-file-1.avi

  • Creating GP2X video files with Mencoder

    Posted on January 14th, 2007 bill 1 comment

    gp2x

    Here is a simple script for converting video files for use on the GP2X, videos are scaled to 320×240 to save storage space. No error checking is included.

    Cut and paste the following code into a file and call it say gp2x-convert, make it executable and then issue

    ‘./gp2x-convert sourcefile.avi destfile.avi’.

    #!/bin/sh

    if [ -z "$1" ]; then
    echo usage: $0 source_video_file gp2x_dest_file.avi
    exit
    fi

    INFILE=$1
    OUTFILE=$2

    echo $INFILE
    echo $OUTFILE

    /usr/bin/mencoder “$INFILE” -o “$OUTFILE” -ovc xvid -xvidencopts bitrate=320 -vop scale=320:240 -oac mp3lame -lameopts abr:br=128

    I would appreciate your feedback if you have comments, corrections or additions to this article, Thanks.

  • Configuring the GP2X on Mandriva 2007

    Posted on January 4th, 2007 bill No comments
    GP2X Handheld Game Console

    GP2X Handheld Game Console

    My new toy is the GP2X, a linux based handheld multimedia device.  It’s an awesome little device.  If you want to know more about the features of the GP2X click here.

    Below I have detailed the steps I made to make life easier when using the GP2X with Mandriva Linux 2007.

    The GP2X can act as a standard USB storage device, allowing you to drag and drop files just like you do with a hard disk.  This is good but using the USB Network feature of the GP2X is much more useful and once setup a lot easier to use.  As an added bonus you can still use the GP2X while it is connected and transferring files.

    Before beginning see this article at http://wiki.gp2x.org/wiki/UsbNet_on_Linux and follow the instructions under “Troubleshooting”.  This will make your GP2X compatible with the 2.6 Kernel of Mandriva 2007. (This step may not be necessary, but until I did this the network would lock up).

    To setup the GP2X end go into “Setting” from the main menu, then select “System”, make sure “Menu Extension” is on.  Scroll down to “USB Network”.  Make these settings…

    USB Network: Always On

    IP: 192.168.0.2

    FTP,Telnet Server: Always On

    Samba Server: Always On

    Press “B” to save the settings, there may be a slight pause while the network starts.

    To setup the PC end, first create a file called “gp2x.rules” in /etc/udev/rules.d containing the following lines

    # Experimental rules to automatically bring up usb0 when the GP2X is connected.
    ATTRS{configuration}==”CDC Ethernet”,ATTRS{product}==”RNDIS/Ethernet Gadget”,RUN+=”/usr/bin/gp2x”

    Now create a file in /usr/bin called gp2x and make it executable. (ie chmod +x /usr/bin/gp2x), with these contents

    #!/bin/sh

    echo $ACTION-`date` >> /tmp/gp2x-status

    if [ "$ACTION" = "add" ]
    then
    /sbin/ifconfig usb0 192.168.0.1 192.168.0.1
    fi

    Now plug in and switch on your GP2X, if all goes well in a short while you should have a network interface called usb0, check this by issuing a /sbin/ifconfig command.  Now to access your GP2X you can run “telnet 192.168.0.2″, login as root, default is no password.

    You can also access the GP2X samba share by running konqueror using the address smb://gp2x or open up straight into the sd card using smb://gp2x/gp2x/mnt/sd.

    I’ve added two icons to my desktop to make life easier.  (Right click on the desktop and select New). The first icon is an “Link to application” called “GP2X Console” which runs “/usr/bin/konsole –T GP2X -e telnet  -l root 192.168.0.2″, this automatically opens up a console and logs you in.  The other icon is a “Link to URL” which is called “GP2X Network” and has a location of “smb://gp2x/gp2x/mnt/sd”.

    Here are the icons I used for the links.

    gp2x This one for console. (Thanks to Paul for this icon, see http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,8,1960)
    gp2x-net and this one for network, which I modified from the above icon.

    Hope this helps.  Now if someone can show me how to automatically display and remove these icons on the desktop when the GP2X is plugged /unplugged that would be great. I would appreciate your feedback if you have comments, corrections or additions to this article, Thanks.

  • Using WRT54GP2 with MyNetFone

    Posted on December 4th, 2006 bill No comments

    Setting up VoIP is not always trivial, here I document the settings I used to get the Linksys WRT54GP2 wireless router to work with MyNetFone. Also see the support page on http://www.mynetfone.com.au for more info.

    You can access the router in your browser at http://192.168.15.1 (substitute your assigned IP address if you have changed it).

    Basic settings page http://192.168.15.1/Voice_Line1.htm

    Display Name: 09XXXXX {Your account number}
    User ID: {Same Again}
    Authentication User Name: {Same Again}
    Authentication Password: ************** {Your Password – Case Sensitive}
    Registration / Proxy Server: sip01.mynetfone.com.au
    Voice Quality: Good (G.729 Require 8k Bandwidth)

    Now the trickier part, you need to go to the “hidden” page at http://192.168.15.1/Voice_adminPage.htm

    Here select “Line 1″ and ensure that “Line Enable” is set to “Yes” and “Use Auth ID” is set to “No”.

    Now scroll down and at “Dial Plan” enter a dial plan, something like the following should work OK,

    (*xx.|000S0|121S0|151S0|181S0|[2-9]xxxxxxxS0|0[23478]xxxxxxxxS0|0011xxx.|1800xxxxxxS0|
    1300xxxxxxS0|13[1-9]xxxS0|xxx.)

    Now, click “Save Settings”, if you get an error at this point, don’t worry the settings will still be saved, just wait about 10 seconds, then enter http://192.168.15.1/Voice_adminPage.htm again to see the updated settings.

    That’s it, plug a telephone into Line 1 and you should get a dial tone and be able to make calls.

    To setup Line 2 repeat the above steps substituting Line 2 where appropriate.