DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-02-03 11:41:31

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Buildsystem for the DNS

Hi,

After many attempts I finally made it. And it was just too damn simple to not share with you all. The following instruction will instruct you how to make your DNS-323 a build system for you to build executables that works on the unit - without debian or any other stuff.

I also include an instruction on how to compile ctorrent, a very small and simple command-line torrent tool

The uClibc Buildsystem (greetings to uClibc development team)
=========================================
Step 1 - Download a pre-compiled uClibc development system
Step 2 - Extract the file in /mnt/HD_a2/.
Step 3 - chroot into the build system

# cd /mnt/HD_a2
# mkdir root_fs
# mount -o loop root_fs_arm.ext2 root_fs
# mkdir root_fs/mnt/HD_a2
# mount --bind /mnt/HD_a2 root_fs/mnt/HD_a2
# ./lnx_bin/busybox3 chroot root_fs /bin/su -


That's it, now you can compile eg. ctorrent. Remember to link static

Step 1 - Download ctorrent
Step 2 - Extract and copy to the build system
-- on the chroot'ed build system --
# cp /mnt/HD_a2/ctorrent-1.3.4-dnh2.2.tar.gz .
# tar xvfz ctorrent-1.3.4-dnh2.2.tar.gz
# cd ctorrent-dnh2.2

Step 3 - Build static linked file
# ./configure
# make LDFLAGS=-static


Done, now just copy the output file (ctorrent) to your non-chroot system and start feeding your 'stuff'. And, don't forget to link your future builds static....

edit:forgot to create root_fs and mount the file in instructions above, sorry.
edit2:Seems the filesystem gets full quickly. Had great trouble compiling dropbear. Didn't manage to resize2fs for some reason. So; it's buggy, be aware.
edit3:Don't use this method, applications will most likely "Segmentation Fault".

/Apan

Last edited by Apskaft (2007-02-06 19:33:28)

Offline

 

#2 2007-02-04 23:33:25

jerrison
Member
Registered: 2007-02-04
Posts: 13

Re: Buildsystem for the DNS

hi there...
hereīs an idea for more space to compile succesfully larger apps (rtorrent, i.e.):
copy the root_fs folder to another folder like cp -a bin /mnt/HD_a2/builder. do that for every folder except /mnt.
you can can then chroot to that system and wonīt encounter compiler issues...at least that worked for me!

Thnx for all your input!

Offline

 

#3 2007-02-05 08:18:25

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Re: Buildsystem for the DNS

jerrison wrote:

hi there...
hereīs an idea for more space to compile succesfully larger apps (rtorrent, i.e.):
copy the root_fs folder to another folder like cp -a bin /mnt/HD_a2/builder. do that for every folder except /mnt.
you can can then chroot to that system and wonīt encounter compiler issues...at least that worked for me!

Thnx for all your input!

Yes, but after a while the filesystem gets full anyway. Tried this approach with dropbear but it seems to temporarily using the rootsystem anyway. And, eventually you'll need to add libraries to your nearly full file-system anyway (currently 97% utlization).

But; I managed to perform a resize2fs and the problem was between the keyboard and the chair - as usual. Didn't know that the argument to resize2fs was i 1k blocks which was the reason for resize2fs to take so damn long time and why it ate all my disc space ;-)

So; chroot into the debian system and preform a resize2fs on the file and you're there...just remember to umount before.


edit:Oh, and one more thing. The filesystem contains quite a lot of sym-links, so cp -R is not an option. Much easier to just resize2fs...

/FS

Last edited by Apskaft (2007-02-05 13:20:38)

Offline

 

#4 2007-02-06 01:15:29

jerrison
Member
Registered: 2007-02-04
Posts: 13

Re: Buildsystem for the DNS

did you by any chance manage to compile rtorrent/libtorrent? i basically looking for a way to monitor a folder fpr *.torrents and automatically download them and havenīt succeeded so far. maybe you already figured that one out and iīd be happy to know how smile.

Offline

 

#5 2007-02-06 07:40:21

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Re: Buildsystem for the DNS

jerrison wrote:

did you by any chance manage to compile rtorrent/libtorrent? i basically looking for a way to monitor a folder fpr *.torrents and automatically download them and havenīt succeeded so far. maybe you already figured that one out and iīd be happy to know how smile.

Havn't tested yet. And to be honest, it's much easier to get things working in the "debian chroot" than compiling using uClibc. I'm having severe problems getting FireFly running properly in a "standalone mode" compiled with uClibs, but in the "debian chroot" it works like a charm.

I reccomend you to install a debian chroot and compile rtorrent/libtorrent within. And; to be honest I think all you have to do is to "apt-get install rtorrent" and you're all set.

However, I like your idea but I don't like the ncurses GUI of rtorrent. Instead I'm opting for an btg installation which will give me what you aim for, but from a browser. Before I get btg running I first need to get lighthttpd+php5 running.

HTH/Apan

Offline

 

#6 2007-02-06 19:32:35

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Re: Buildsystem for the DNS

I can no longer reccomend to use this method as the uClibc related files are not compatible with the ones on the unit. Simple applications can work, but many will fail. E.g. FireFly cannot be compiled as the libdl.so.0 and libpthread.so.0 are not compatible with the ones used building the application. Can not even be used with proper LD_LIBRARY_PATH settings.

Instead I suggest to use D-Links toolchain as described by magore.

:-(

/Apan

Offline

 

#7 2007-02-07 00:22:43

jerrison
Member
Registered: 2007-02-04
Posts: 13

Re: Buildsystem for the DNS

yeah i figured that one out as well...i compiled rtorrent and it starts but crashes with errors that inidicate memory handling problems. and iīm not that much of a linux power user smile.
do you happen to know a good document for crosscompiling binaries the "magore"-way?

Offline

 

#8 2007-04-08 20:58:50

Raven
Member
Registered: 2007-04-06
Posts: 25

Re: Buildsystem for the DNS

Hi there,

as I have read your previous posts and several other comments, I'm really confused about the possibility to add a torrentclient.
Apskaft said, his first attempts to add a torrent client worked, but didn't work well.
Now I'm looking for a way to add a torrentclient without installing debian on the box.
Would be well if anybody could help me....

greeting from Germany
Alex

Offline

 

#9 2007-04-09 02:53:53

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Buildsystem for the DNS

Apskaft wrote:

Instead I suggest to use D-Links toolchain

If you use the cross compilers, I'd be interested in your build procedure. I haven't tried to compile bittorrent clients myself, but I'd like to add one to my LFS-based system.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB