Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Compiling made relatively easy

  1. #1
    Join Date
    Feb 2010
    Posts
    640

    Default Compiling made relatively easy

    So there's a couple of machines that I have that have nice features but are missing some programs/utilities I would like them to have.

    To get things done faster, I've turned to using an os-virtualizer along with a system image for a mipsel device.

    On my ubuntu laptop I have added two things that have made compiling for such devices a bit easier:
    QEMU:
    http://wiki.qemu.org/Main_Page (here's a link to a windows qemu project:http://www.davereyn.co.uk/download.htm)
    In combination with the system-image-mipsel.tar.bz2 from:
    http://impactlinux.com/fwl/downloads/binaries/

    After I've installed qemu (via synaptic package manager in ubuntu, or however) I run the dev-environment.sh script from the system-image-mipsel.tar.bz2 above.

    That starts the virtualized mipsel with an add on savable space, hdb.img.

    So, for example, I wanted to compile a program for the playlist script I've been tinkering with. Mixing a 4000 line file by way of bash took upwards of 5 minutes. A compiled program would run much faster.

    I found a program called shuffle that would do exactly what I needed with source code available:
    http://www.eskimo.com/~scs/src/

    So I went to the directory I untarred system-image-mipsel.tar.bz2 to. then:

    Code:
    ./dev-environment.sh
    (qemu load the mipsel image and I get this new prompt)
    (mipsel) /home #
    wget ftp://ftp.eskimo.com/u/s/scs/src/shuffle.tar.gz
    tar -xzf shuffle.tar.gz
    cd shuffle
    make
    ((wait for shuffle to compile when done:))
    exit
    Now back on my ubuntu system, I need to load that writable space that the system-image-mipsel was using, so:
    Code:
    mkdir temp
    sudo mount -o loop hdb.img temp/
    ((sudo is an ubuntu-required step for mounting, your linux install may not need it))
    cp temp/shuffle/shuffle .
    And now you should have your copy of your compiled shuffle executable in your folder.

    Move it on over to your media player. Try it out.

    Code:
    ./shuffle -help
    usage: shuffle [options] [-o outputfile] [inputfiles ...]
    -h, -?  print this help message
    -o file output to file
    -seed s use initial seed s
    -seedfile f  keep seed state in f
    Now things get harder with more advanced executables. You might need libraries and other depencies to be resolved. Nonetheless, this is a shortcut for some compiling needs.

    EDIT_NOTE:
    I saw this in the README:

    If both distccd and a compatible $ARCH-cc cross compiler are in the $PATH,
    dev-environment.sh will automatically set up distcc to call out through the
    virtual network to the host's $ARCH-cc, to move the heavy lifting of
    compilation outside the emulator, and also take advantage of SMP. (Doing
    so does not require the package being built to be cross compile aware.
    As far as the emulated build environment is concerned, it's still performing
    simple single-context native builds.)
    I downloaded, made and installed distcc on my ubuntu laptop, used the http://impactlinux.com/fwl/downloads...mipsel.tar.bz2, untarred and added to my PATH, and by golly, the making is much faster- which means my more ambitious compilations return errors faster!

    -wigout
    Last edited by wigout; 09-18-2010 at 04:20 PM.

  2. #2
    Join Date
    Dec 2009
    Location
    Canada (ON)
    Posts
    2,036

    Thumbs up Right on!!!

    Very nice post wigout; I guess I have something to do this weekend. This can be very useful.

  3. #3
    Join Date
    Dec 2009
    Location
    Canada (ON)
    Posts
    2,036

    Default

    This is absolutely awesome and works great. Much easier to compile a program than using the tool-chain cross-compiling setup. It feels a lot more natural to me it just like compiling any other C++ program on the PC. The configure command worked great to create the makefile.

    Yeah! no more screwing around with tool-chain.

    I even put some of the program that are used on the PBO like DvdPlayer to run it on the simulator to see if I can discover any hidden secrets ..... so far nada; still trying to mimic the PBO directory structure to keep DvdPlayer happy. I also tried to replace the image image-mipsel.sqf with the one from the PBO (install.img + yaffs_2.img) but as suspected qemu quit abruptly with an error. I guess I am going to have to read some more on the format of that image-mipsel.sqf image.

    Thanks again wigout!!!!
    Last edited by snappy46; 09-18-2010 at 05:38 AM.

  4. #4
    Join Date
    Feb 2010
    Posts
    640

    Default

    Working around the unwritable system directories has been interesting in compiling.

    You can specify all your --prefix --exec-prefix when you configure....


    but in the end this is what I have been doing:
    whatever I need to be writable, let's say /usr/lib /usr/include, etc, I:
    cp -a /usr /home
    mount -o bind /home/usr /usr

    then the space is writable (till I exit and load it back up again) and I can "revert" to the naked system by simply not overmounting those directories....

    I have no idea how you'd contrive it to accept another system image like the build system for all the realtek players....

    here's the bit about that from aboriginallinux (I mean impact linux- they changed their name sometime ago):
    http://impactlinux.com/fwl/documenta...l#new_platform

    It's something you can fool around in, really wreck trying to get stuff to compile, without having to worry about destroying your player....

    -wigout

  5. #5
    Join Date
    Feb 2010
    Posts
    640

    Default

    And just for completeness sake I'll note that at:
    http://impactlinux.com/fwl/downloads/binaries/extras/

    You'll find precompiled static mipsel binaries for:
    busybox-mipsel
    dropbearmulti-mipsel
    strace-mipsel

    I know a static busybox is available from busybox, but strace and dropbear are both useful in their own right.

    from http://impactlinux.com/fwl/downloads/binaries/README:

    busybox-$ARCH

    This is a prebuilt static busybox binary for the given target, implementing
    numerous standard command line utilities.

    To use, copy it to a target system (perhaps via wget), set the executable
    bit, and create the appropriate symlinks to it.

    Run ./busybox-$ARCH to see the list of supported commands. It provides
    the default configuration ("make defconfig") of busybox.

    dropbearmulti-$ARCH

    This is a prebuilt static dropbear binary for the given target, implementing
    an ssh server, ssh client, and associated utilities such as scp.

    To use, copy it to a target system (perhaps via wget), set the executable
    bit, and create the appropriate symlinks to it.

    Run ./dropbearmulti-$ARCH to see the list of supporte commands.

    strace-$ARCH

    This is a prebuilt static strace binary for the given target, providing a
    debugging tool listing all the system calls made by another program.

    To use, copy it to a target system (perhaps via wget) and set the executable
    bit.



  6. #6
    Join Date
    Dec 2009
    Location
    ON, Canada
    Posts
    4,910

    Default

    5 stars from me ..
    good job wigout.
    [*]Still new..? check the wiki. [*]Your shares gone for no reason ? Create a machine shortcut. [*]Trashing the G-adapter? upgrade cheaply to N. [*]Getting the hang of it? get organized .. add share shortcuts. [*]Getting sick of it ? it never hurts to rant here [*]Wishing for the time machine? give your PBO a makeover. [*]Bricked it while doing so ? unbrick it for $5[*]Not into cross flashing? keep it semi-official [*]Too lazy to read all that ? you asked for it.[*] Thank U PBO

  7. #7
    Join Date
    Feb 2010
    Posts
    640

    Default

    Just built, static, tested from the command line (don't know how well it will jive with the DvdPlayer itself- It may run run without blinking or choke):
    btpd
    btcli
    btinfo
    from the source: http://cloud.github.com/downloads/bt...pd-0.16.tar.gz

    using aboriginal linux mipsel image noted above.

    Read the README for more info on btpd:
    https://github.com/btpd/btpd/blob/master/README

    the firmware btpd usually can be found at /usr/local/bin/package


    I'd suggest someone who wants to try this out do the following:
    (you need at least 375kb on /usr/local/etc to download the file)

    startup player
    make sure you don't have torrents actively seeding or downloading.
    telnet to player
    Code:
    cd /usr/local/etc/
    wget http://rtd1073binaries.googlecode.com/files/btpd
    chmod +x btpd
    mount -o bind /usr/local/etc/btpd /usr/local/bin/package/btpd
    and then try it out loading torrents the usual way.

  8. #8
    Join Date
    Feb 2010
    Posts
    640

    Default

    here's the "help" file for btpd:
    Code:
    btpd is the BitTorrent Protocol Daemon.
    
    Usage: btpd [-d dir] [-p port] [more options...]
    
    Options:
    -4
            Use IPv4. If given in conjunction with -6, both versions are used.
    
    -6
            Use IPv6. By default IPv4 is used.
    
    --bw-in n
            Limit incoming BitTorrent traffic to n kB/s.
            Default is 0 which means unlimited.
    
    --bw-out n
            Limit outgoing BitTorrent traffic to n kB/s.
            Default is 0 which means unlimited.
    
    -d dir
            The directory in which to run btpd. Default is '$HOME/.btpd'.
    
    --empty-start
            Start btpd without any active torrents.
    
    --help
            Show this text.
    
    --ip addr
            Let the tracker distribute the given address instead of the one
            it sees btpd connect from.
    
    --ipcprot mode
            Set the protection mode of the command socket.
            The mode is specified by an octal number. Default is 0600.
    
    --logfile file
            Where to put the logfile. By default it's put in the btpd dir.
    
    --max-peers n
            Limit the amount of peers to n.
    
    --max-uploads n
            Controls the number of simultaneous uploads.
            The possible values are:
                    n < -1 : Choose n >= 2 based on --bw-out (default).
                    n = -1 : Upload to every interested peer.
                    n =  0 : Dont't upload to anyone.
                    n >  0 : Upload to at most n peers simultaneously.
    
    --no-daemon
            Keep the btpd process in the foregorund and log to std{out,err}.
            This option is intended for debugging purposes.
    
    -p n, --port n
            Listen at port n. Default is 6881.
    
    --prealloc n
            Preallocate disk space in chunks of n kB. Default is 2048.
            Note that n will be rounded up to the closest multiple of the
            torrent piece size. If n is zero no preallocation will be done.

  9. #9
    Join Date
    Aug 2010
    Posts
    26

    Default

    Quote Originally Posted by wigout View Post
    Thanks for that info'. Sadly impact domain is no more

    Any alternative for a recent static build for busybox please?

  10. #10
    Join Date
    Feb 2010
    Posts
    640

    Default

    Here's the top download directory link:
    http://www.landley.net/aboriginal/downloads/binaries/

    Here's busybox-mipsel:
    http://www.landley.net/aboriginal/do...busybox-mipsel

    (I don't think impactlinux.com is toast, but it is down for the moment)

    -wigout

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •