Recently I bought a Western Digital Mybook World Edition II NAS, before i purchased it i was sure to find out whether it had an embedded linux distribution installed on it, and if there were hacks available to enable ssh access etc. Luckily, there were (one doesn’t even need physical access to work). So, ive been working to get the following going:
- LFTP
- PureFTPD
- Samba
- Screen
and after about 4 or 5 weeks of work, everything is working correctly with compilation problems cropping up every now and then. One of the WORST errors that was so goddamn annoying was the following (when compiling lftp):
./.libs/liblftp-jobs.a(commands.o): In function `cmd_chmod(CmdExec*)’:
commands.cc:(.text+0×5cb0): undefined reference to `mode_compile’
./.libs/liblftp-jobs.a(FileSetOutput.o): In function `FileSetOutput::print(FileSet&, OutputJob*) const’:
FileSetOutput.cc:(.text+0xc4): undefined reference to `rpl_fnmatch’
FileSetOutput.cc:(.text+0×268): undefined reference to `human_readable’
FileSetOutput.cc:(.text+0×4e0): undefined reference to `strmode’
./.libs/liblftp-jobs.a(QueueFeeder.o): In function `QueueFeeder::get_next_match(char const*, QueueFeeder::QueueJob*)’:
QueueFeeder.cc:(.text+0×7f0): undefined reference to `rpl_fnmatch’
./.libs/liblftp-jobs.a(QueueFeeder.o): In function `QueueFeeder::MoveJob(char const*, int, int)’:
QueueFeeder.cc:(.text+0×8c8): undefined reference to `rpl_fnmatch’
./.libs/liblftp-jobs.a(FindJobDu.o): In function `FinderJob_Du::print_size(long long, char const*)’:
FindJobDu.cc:(.text+0×6f8): undefined reference to `human_readable’
./.libs/liblftp-jobs.a(ChmodJob.o): In function `ChmodJob::GetMode(FileInfo const*) const’:
ChmodJob.cc:(.text+0×230): undefined reference to `mode_adjust’
./.libs/liblftp-jobs.a(ChmodJob.o): In function `ChmodJob::CurrentFinished(char const*, FileInfo const*)’:
ChmodJob.cc:(.text+0×2c0): undefined reference to `strmode’
/root/lftp-3.5.12/src/.libs/liblftp-tasks.a(ResMgr.o): In function `ResMgr::Resource::ClosureMatch(char const*)’:
ResMgr.cc:(.text+0×99c): undefined reference to `rpl_fnmatch’
/root/lftp-3.5.12/src/.libs/liblftp-tasks.a(FileSet.o): In function `fnmatch_dir(char const*, FileInfo const*)’:
FileSet.cc:(.text+0×20f0): undefined reference to `rpl_fnmatch’
/root/lftp-3.5.12/src/.libs/liblftp-tasks.a(FileGlob.o): In function `Glob::add(FileInfo const*)’:
FileGlob.cc:(.text+0×264): undefined reference to `rpl_fnmatch’
/root/lftp-3.5.12/src/.libs/liblftp-tasks.a(PatternSet.o): In function `PatternSet::Glob::Match(char const*)’:
PatternSet.cc:(.text+0×314): undefined reference to `rpl_fnmatch’
/root/lftp-3.5.12/src/.libs/proto-http.a(Http.o): In function `Http::CookieClosureMatch(char const*, char const*, char const*)’:
Http.cc:(.text+0×1f60): undefined reference to `rpl_fnmatch’
collect2: ld returned 1 exit status
make[1]: *** [lftp] Error 1
make[1]: Leaving directory `/root/lftp-3.5.12/src’
make: *** [all-recursive] Error 1
and that was fixed by installing gnu-findutils. Some other stuff also cropped up, which was mainly caused by western digital opting to use ‘ucLibC’ over GlibC (uclibc is a portable c library made for use on portable devices, whereas the latter is made for fullsize linux distributions. One of the drawbacks is that it doesnt support streams. Some specs of the device are:
[root@storage lftp-3.5.12]# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 2.8G 981M 1.7G 37% /
/dev/root 2.8G 981M 1.7G 37% /
/dev/md3 950M 20M 883M 3% /var
/dev/md4 455G 111G 344G 25% /shares/internal
[root@storage lftp-3.5.12]# cat /proc/cpuinfo
Processor : ARM926EJ-Sid(wb) rev 5 (v5l)
BogoMIPS : 99.73
Features : swp half thumb fastmult edsp java
CPU implementer : 0×41
CPU architecture: 5TEJ
CPU variant : 0×0
CPU part : 0×926
CPU revision : 5
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size : 32768
I assoc : 4
I line length : 32
I sets : 256
D size : 32768
D assoc : 4
D line length : 32
D sets : 256
One drawback is that by default, the NAS has a bunch of java crap installed on it (its called mionet, its generally used for ‘worldwide sharing’ which can also be accomplished with an ftp server), and as everyone would know, java chews a hell of a lot of cpu and memory, so the first task was getting rid of that.
Anyway, by this point you’ve noticed that this post is almost nonsensical. One great resource for the mybook is http://martin.hinner.info/mybook/
Enjoy.