How to successfully build packages for WD My Cloud from source

The WD My Cloud comes with a Debian wheezy system on it. However WD customized that in a way that it is hardly possible (if not impossible at all) to install new packages using the standard "apt-get install <package name>" way, especially when you update the device firmware to version 4.x or later. The latest firmware, in fact, uses a modified Debian system with 64K sized memory pages: if you install a package using "apt-get install <package name>" from the standard repositories, almost certainly it won't run and produce just a laconic "Killed" output.
So, to install new packages on the My Cloud you need to build them from source on another system, copy the obtained deb packages on the My Cloud and install.
WD provides a GPL source package of the latest firmware on their website, which contains a build environment to perform this operation. This is totally at the end-user own risk, since no support at all is provided by WD and installing 3rd party software may void warrany.
An additional problem is that the build environment provided by WD has a "minor" problem that causes the building process of most packages to fail because of a GCC compiler segmentation fault.
This guide shows how to deal with this problem and, in general, how to create a build environment to easily do the task.
Some Linux knowledge is needed.
NOTE 1: as of now, this procedure is surely needed to build packages for the 4.x firmware; however, by experience, I find out that it's a useful procedure even if you are sticking with the 3.x firmware; so the guide explains how to build packages for both firmware versions
NOTE 2: in principle, it should be possible to build packages directly on the My Cloud, instead of using an external system; however I don't think it's a good idea to try this, because of many reasons, including: the My Cloud system is surely slower than a regular PC to compile packages; you would need to install all the development tools on the My Cloud itself (and this may require in turn to build them on another system first...)
Step 1: prepare the build system (required only once)
The build environment must be a Linux system, either Debian-based or Ubuntu-based. I personally suggest to create a virtual machine with such a system in it. This guide will take this route.
Download and install VirtualBox (https://www.virtualbox.org/) on your phisical system (either Linux, Windows or Mac). Start VirtualBox and create a new virtual machine for a Debian 64-bit. The default settings suggested by VirtualBox regarding memory, disk size and VM configuration should be ok to start.
After the VM is ready, download a Debian Wheezy 64-bit ISO image; I suggest the netinst image, which is the smaller one. Right now, Debian 7.8.0 is available and the direct links are:

注意,强烈推荐用最新的Debian 8.3系统来进行编译,就目前的编译经验来讲,Debian 8.3所使用的Qemu修正了大量的BUG,尤其是编译期间出现的大量的"段错误(Segment fault)",7.8版本上完全无法通过编译的软件,在8.3上轻松编译通过。

Boot the VM with the downloaded ISO mounted in and install just the Debian base system (nothing else is required). Refer to VirtualBox and Debian websites for documentation on how to perform these operations.

Once the guest VM is installed, we need to make just a couple little tunings. First of all, Debian Wheezy comes with qemu-user-static package version 1.1.2. Qemu is an environment needed to emulate an actual ARM system on another platform, like the AMD64 platform our build system consists of. It's a good idea to update Qemu to version 2.x from the wheezy-backports repository. To do this, start the build system and login. Then:

# sudo su
# sudo echo "deb http://security.debian.org/ wheezy-backports main contrib non-free" >>/etc/apt/sources.list
# sudo apt-get update
# sudo apt-get -t wheezy-backports install qemu-user-static

对于国内的用户,使用官方源可能无法更新,建议如下设置

# sudo su
# sudo echo "deb http://mirrors.163.com/debian/ wheezy-backports main contrib non-free" >>/etc/apt/sources.list
# sudo apt-get update
# sudo apt-get -t wheezy-backports install qemu-user-static

如果使用现在最新的Debian 8.3版本,则不需要继续在backports中安装qemu了,执行如下命令即可。

# sudo apt-get update
# sudo apt-get install qemu-user-static

This should also install binfmt-support, which is another packages needed by the build environment. If this is not the case, also type:

# sudo apt-get install binfmt-support

Now, let's prepare the actual build environment. Let's create a folder in the /root directory of the build system and download the WD My Cloud 4.x firmware source package from WD website.

# cd /root
# mkdir wdmc-build
# cd wdmc-build
# wget http://download.wdc.com/gpl/gpl-source-sequoia-04.01.02-417.zip?v=7111 -O gpl-source-sequoia-04.01.02-417.zip

In case the link changes, refer to WD My Cloud support page to find the new one: http://support.wdc.com/product/download.asp?groupid=904&lang=en

I then suggest to create different folders for different build scenarios. These are the possibilities:

  • the target system may be firmware 3.x (4k) or firmware 4.x (64k)
  • the source package base may be wheezy (Debian stable) or jessie (Debian testing); wheezy contains older packages, but that should run happily in My Cloud (which has a Wheezy in it!), while jessie contains newer packages that might also work and provide updated versions of many applications; I would personally recommend to build packages from wheezy, unless you absolutely need a newer version that is only in jessie

I don't recommend to mix things, so I would create different folders for any different combination. You're free to create just the one you are interested in, so among the following commands type fhe first ones, then only the block of commands of the combination(s) you're interested in, then the last command:

# cd /root/wdmc-build
# unzip gpl-source-sequoia-04.01.02-417.zip packages/build_tools/debian/*

# mkdir 64k-wheezy
# cp -R packages/build_tools/debian/* ./64k-wheezy
# echo '#!/bin/bash' >>64k-wheezy/build.sh
# echo './build-armhf-package.sh --pagesize=64k $1 wheezy' >>64k-wheezy/build.sh
# chmod a+x ./64k-wheezy/build.sh

# mkdir 64k-jessie
# cp -R packages/build_tools/debian/* ./64k-jessie
# echo '#!/bin/bash' >>64k-jessie/build.sh
# echo './build-armhf-package.sh --pagesize=64k $1 jessie' >>64k-jessie/build.sh
# chmod a+x ./64k-jessie/build.sh

# mkdir 4k-wheezy
# cp -R packages/build_tools/debian/* ./4k-wheezy
# echo '#!/bin/bash' >>4k-wheezy/build.sh
# echo './build-armhf-package.sh --pagesize=4k $1 wheezy' >>4k-wheezy/build.sh
# chmod a+x ./4k-wheezy/build.sh
# mkdir 4k-jessie
# cp -R packages/build_tools/debian/* ./4k-jessie
# echo '#!/bin/bash' >>4k-jessie/build.sh
# echo './build-armhf-package.sh --pagesize=4k $1 jessie' >>4k-jessie/build.sh
# chmod a+x ./4k-jessie/build.sh
# rm -rf packages/

In this way, in every folder will be created a build.sh script that passes the right parameters to the WD provided script, requiring only the name of the package to build. This would work straight away if there weren't the problem with qemu I mentioned in the beginning, so another step is required to finish the prepare phase. Again, only type commands for the scenario(s) you're interested in:

64k-wheezy:

# cd /root/wdmc-build/64k-wheezy
# ./setup.sh bootstrap/wheezy-bootstrap_1.24.14_armhf.tar.gz build
# mv build/usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static_orig
# cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static

64k-jessie:

# cd /root/wdmc-build/64k-jessie
# ./setup.sh bootstrap/jessie-bootstrap_5.14.14_armhf.tar.gz build
# cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static

4k-wheezy:

# cd /root/wdmc-build/4k-wheezy
# ./setup.sh bootstrap/wheezy-bootstrap_1.24.14_armhf.tar.gz build
# mv build/usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static_orig
# cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static

4k-jessie:

# cd /root/wdmc-build/4k-jessie
# ./setup.sh bootstrap/jessie-bootstrap_5.14.14_armhf.tar.gz build
# cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static

The meaning of the above is the following: prepare an emulated ARM system and replace the qemu-arm-static binary provided by the bootstrap with the recent one we've installed in our actual build system.

Ignore any errors produced by setup.sh: that script is really buggy and many things it tries to do seem to be useless, unless we apply the mentioned qemu fix.

As a final step, I would recommend to edit the sources file list within the armhf build subsystem in order to be able to build packages that are in any of the distribution repositories. To do this, type the following:

# cd /root/wdmc-build
# nano <scenario>/build/etc/apt/sources.list

by replacing <scenario> with the desired one (64k-wheezy, 64k-jessie, 4k-wheezy, 4k-jessie); the nano editor will open, then replace the contents of the existing file with the following:

For 64k-wheezy and 4k-wheezy:

deb  http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
deb  http://ftp.debian.org/debian wheezy-updates main contrib non-free
deb-src  http://ftp.debian.org/debian wheezy-updates main contrib non-free
deb http://ftp.debian.org/debian wheezy main contrib non-free
deb-src  http://ftp.debian.org/debian wheezy main contrib non-free

#deb http://ftp.debian.org/debian wheezy-backports main contrib non-free
#deb-src http://ftp.debian.org/debian wheezy-backports main contrib non-free

For 64k-jessie and 4k-jessie:

deb  http://security.debian.org/ jessie/updates main contrib non-free
deb-src  http://security.debian.org/ jessie/updates main contrib non-free
deb  http://ftp.debian.org/debian jessie-updates main contrib non-free
deb-src  http://ftp.debian.org/debian jessie-updates main contrib non-free
deb  http://ftp.debian.org/debian jessie main contrib non-free
deb-src http://ftp.debian.org/debian jessie main contrib non-free

In case of wheezy, uncomment the last two lines if you want to build package versions from wheezy-backports. I don't know however if additional changes to the build.sh script (or better to the WD provided one) are needed to instruct apt to download and build the source from the backports repository. I don't have tried it yet. Anyway, I would recommend to leave those two lines commented unless you actually need something from the backports repository.

Save the file by hitting Ctrl+X, Y, Enter.

Now you're ready to build your first package!

如果使用现在最新的Debian 8.3版本,需要把主机的域名解析的配置文件,复制到编译的对应目录,否则会造成无法解析域名(当然,也可以自行编辑一个正确的resolv.conf文件,指定域名解析服务器地址)。

# cd /root/wdmc-build
# cp /etc/resolv.conf <scenario>/build/etc/

Optional additional step (not strictly required) for wheezy scenarios

You may also want to use an updated C++ compiler to build packages in the wheezy scenarios. Debian Wheezy provides g++ package 4.6, but 4.7 is also available. With the following commands you can install the new version and then switch from one to the other using update-alternatives:

# cd /root/wdmc-build/<scenario>
# chroot build
# apt-get update
# apt-get install g++ g++-4.7
# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++.4.6 10
# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20
# update-alternatives --install /usr/bin/gcc g++ /usr/bin/gcc-4.6 10
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20
# rm /usr/bin/cpp
# update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.6 10
# update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.7 20
# exit

After these commands, the default C++ compiler will be version 4.7. You can then switch to the old version by typing:

# cd /root/wdmc-build/<scenario>
# chroot build
# update-alternatives --set cpp /usr/bin/cpp-4.6
# update-alternatives --set gcc /usr/bin/gcc-4.6
# update-alternatives --set g++ /usr/bin/g++-4.6
# exit

Or use

update-alternatives --config <command>

to get an interactive prompt.

Step 2: build your package
It's time to build your package. Let's build htop for instance, a nice replacement for top comma
nd. The example will build it for the scenario 64k-wheezy (i.e: packages suitable for 4.x firmware, built from the version of htop provided by Debian Wheezy). Start your build system, login, then:

# sudo su
# cd /root/wdmc-build/64k-wheezy
# ./build.sh htop

The built package will be placed into /root/wdmc-build/<scenario>/build/root and will consist of one or more .deb files (you'll also find other files and folder, just ignore them and consider only .deb files). Sometimes building a package will build other packages, too: it depends on how package sources are organized. For instance, if you build transmission-daemon, you'll also get the deb packages for the GUI packages (like transmission-gtk or transmission-qt): you can simply throw away those additional debs if you don't need them.

Once the deb files are ready, copy them from the build system to your My Cloud (to achieve this, if you built a VirtualBox VM you may use a shared folder to exchange data with the physical host system). Then, login via SSH to your My Cloud and type:

# dpkg -i <path-to-build-deb-file>/htop_1.0.1-1_armhf.deb

where <path-to-built-deb-file> is the path where you stored the deb file you just built; if you copied it to the standard Public shared folder, the path will be /shares/Public/.

If you're lucky, you're done. Otherwise, the /installation command may prompt you something like this:

dpkg: dependency problems prevent configuration of transmission-daemon:
 transmission-daemon depends on libcurl3-gnutls (>= 7.16.2); however:
  Package libcurl3-gnutls is not installed.

This simply means that the package you're trying to install depends on another package (in this case: transmission-daemon requires libcurl3-gnutls) which is not yet installed. You then need to build in turn this required package, with the same procedure, and install it before the package you originally intended to install. Repeat the steps for all the missing dependencies that dpkg reports. Sometimes, to fix circular dependencies (packages depend on each other), once you've built all the necessary packages you may install them all at once with: dpkg -i <path-to-built-debs>/*.deb, so that dpkg will resolve dependencies automatically.

Final notes

  1. building a package may require a LOT of time, just be patient...
  2. you may periodically clean /root/wdmc-build/<scenario>/build/root folder after you've built your packages, to free up space; in fact, building may require a considerable amount of (temporary) disk space
  3. once installed with dpkg, packages contents are unpacked to the My Cloud system partitions. There should be enough disk space available to not worry about disk space, however almost certainly a firmware upgrade will delete all of your installed packages; I would suggest to create a shared folder using the web UI, named "System", protected by password and accessible only to admin users; inside it you may put your built deb files, organized as you like. In case of a firmware upgrade, you may simply re-install the packages from there using dpkg -i (one at a time, or all of them at once using wildcards, etc.); however please consider the following notes
  4. a firmware upgrade might change the architecture of the provided Debian system and might require to rebuild all packages... this is exactly what happened with the upgrade from 3.x to 4.x firmware, where WD decided to rebuild the whole system using 64k sized memory pages rather than the standard 4k sized ones... I don't think WD is so sadistic to do that again and again, but who knows? I suggest to read carefully the release notes of the new firmware, have a look to the updated GPL source package (if they make it available on their website) and try to install a few small packages after firmware upgrade just to check that everything is ok; installing all in a rush may have catastrophic effects, especially when a package you had built on your own requires to update one of the WD provided ones... if it won't work, it will almost certainly break something of the WD built-in features, causing a device failure in the worst case... again, you are on your own, you get no support for this
  5. to restore the whole functionality of third-party applications after a firmware upgrade, not only you may need to reinstall the deb packages, but you will also need to restore any custom application configuration; if you leave default settings, usually applications save their settings in /etc or in /root, which are both on the system partitions of WD and might be deleted and recreated by the firmware update process; you may choose to backup your application configurations or change things so that they are linked to a shared folder (for instance the aforementioned System shared folder) where they won't be deleted; in this way, after the firmware upgrade you may just need to restore your backups or your symlinks; howerver, the exact procedure may be different for each package and is above the scope of this guide

From the above, two things should be quite clear: disable the automatic firmware upgrade in the web UI and use all of this at your own risk.

目前已知的包编译问题:

  • runit-2.1.1包编译的时候,会提示失败
dpkg-buildpackage: error: debian/rules build gave error exit status 2

原因为其中的一个检查脚本对于 chroot重定向之后的目录检查存在问题,解决方法为找到 “/wdmc-build/64k-wheezy/build/root/runit-2.1.1/runit-2.1.1/src/check-local”,注释掉里面的代码,修改

#!/bin/sh

PATH=`pwd`:$PATH

for i in ${1+"$@"}; do
  echo "Checking $i..."
  env - PATH="$PATH" ctmp="`pwd`/check-tmp" $i.check 2>&1 |cat -v >$i.local
  ./check-diff $i || ( cat $i.local; echo "$i failed."; exit 1 ) || exit 1
done

#!/bin/sh

PATH=`pwd`:$PATH

#for i in ${1+"$@"}; do
#  echo "Checking $i..."
#  env - PATH="$PATH" ctmp="`pwd`/check-tmp" $i.check 2>&1 |cat -v >$i.local
#  ./check-diff $i || ( cat $i.local; echo "$i failed."; exit 1 ) || exit 1
#done
  • 编译 gcc-4.6的时候,会提示失败
dpkg-checkbuilddeps: Build conflicts: binutils-gold
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)
Build command 'cd gcc-4.6-4.6.3 && dpkg-buildpackage -b -uc' failed.
E: Child process failed

解决方法为,手动执行所有的命令,不要让他执行创建子进程命令。

cd ~/wdmc-build/64k-wheezy

chroot build

mount -t proc none /proc
mount -t devtmpfs none /dev
mount -t devpts none /dev/pts

export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
export LC_ALL=C
export LANGUAGE=C
export LANG=C
export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
export DEB_BUILD_OPTIONS=nocheck

cd ~/gcc-4.6-4.6.3

dpkg-buildpackage -d -b -uc

注意,不要编译 gcc-4.7 版本,因为会导致 libstdc++6升级,而libstdc++6升级之后会导致系统工作不正常。

另外,上面的编译完成之后,安装GCC-4.6的时候,会提示libgomp1 这个包不存在,貌似ARM下面到 Gcc-4.6 的时候还不能很好的支持OpenMP,网上的其他编译GCC 4.6 ARM的都是禁用掉了OpenMP的编译。

$ nano /root/gcc-4.6-4.6.3/debian/rules.defs

修改里面的

# gomp --------------------
with_gomp := yes
with_gomp := $(call envfilt, gomp, , , $(with_gomp))

# gomp --------------------
with_gomp := no
with_gomp := $(call envfilt, gomp, , , $(with_gomp))

然后重新编译即可。

  • 编译Subversion的时候提示失败
***
*** Building as root is not supported ***
make: *** [debian/stamp-autogen] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
Build command 'cd subversion-1.6.17dfsg && dpkg-buildpackage -b -uc' failed.
E: Child process failed

这个时候是不能编译成功的,必须用一个非root 的用户执行命令,执行如下命令,增加一个普通用户user,并且安装fakeroot,然后用user的身份登录

$ cd ~/wdmc-build/64k-wheezy

$ su

$ chroot build

$ useradd user

$ apt-get install build-essential

$ apt-get install fakeroot

$ mount -t proc none /proc

$ mount -t devtmpfs none /dev

$ mount -t devpts none /dev/pts

$ export DEBIAN_FRONTEND=noninteractive

$ export DEBCONF_NONINTERACTIVE_SEEN=true

$ export LC_ALL=C

$ export LANGUAGE=C

$ export LANG=C

$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'

$ export DEB_BUILD_OPTIONS=nocheck

此时如果编译还是编译不通过的,主要是JAVAHL部分不能编译通过,ARM下面用的JAVA解析器是gcj-jdk,这个解析器貌似根本不能运行起来,最后会卡在如下的部分,尝试过切换到Open-jdk,可惜也不能编译过去,因此只能去掉这部分的编译

/usr/bin/make -C BUILD -j1 javahl
make[1]: Entering directory `/root/subversion-1.6.17dfsg/BUILD'
/usr/lib/jvm/java-gcj/bin/javac -target 1.2 -source 1.3 -d subversion/bindings/javahl/classes -classpath subversion/bindings/javahl/classes:/usr/share/java/junit.jar /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NotifyStatus.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClientLogLevel.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/CommitMessage.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/CopySource.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Path.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/LogMessageCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/StatusCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Notify.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/RevisionRange.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictVersion.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClientInterface.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SubversionException.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/DiffSummaryReceiver.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ErrorCodes.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/BlameCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/PromptUserPassword3.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ProgressEvent.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNOutputStream.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/DirEntry.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/CommitItemStateFlags.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/PromptUserPassword.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/RevisionKind.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Status.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNInputStream.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ProplistCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/LogMessage.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClientSynchronized.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNAdmin.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Notify2.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictResult.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/LogDate.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Info2.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/InputInterface.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NodeKind.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/PropertyData.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/MergeinfoLogKind.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/LockStatus.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Depth.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Info.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictResolverCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NotifyAction.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/InfoCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ProgressListener.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/BlameCallbackImpl.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/BlameCallback2.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NotifyInformation.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ListCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/JNIError.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/StatusKind.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Lock.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Operation.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangelistCallback.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Revision.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/PromptUserPassword2.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/DiffSummary.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/CommitItem.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ProplistCallbackImpl.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeException.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ConflictDescriptor.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/OutputInterface.java /root/subversion-1.6.17dfsg/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ScheduleKind.java

这时候需要修改源代码的debian/rules文件,去掉JAVAHL部分的编译

$ cd root

$ cd subversion-1.6.17dfsg

$ nano debian/rules

修改

ENABLE_JAVAHL        := yes
DISABLE_JAVAHL_ARCHS := alpha arm hppa m68k mips mipsel hurd-i386
ifneq (,$(filter $(DEB_HOST_ARCH), $(DISABLE_JAVAHL_ARCHS)))
  ENABLE_JAVAHL := 
endif

ENABLE_JAVAHL        := no
DISABLE_JAVAHL_ARCHS := alpha arm hppa m68k mips mipsel hurd-i386
ifneq (,$(filter $(DEB_HOST_ARCH), $(DISABLE_JAVAHL_ARCHS)))
  ENABLE_JAVAHL := no
endif

然后修改

export DH_OPTIONS
ifdef DEB_OPT_WITH_JAVAHL
  # jikes 1.22 cannot compile javahl.
  confflags += --enable-javahl --without-jikes \
               --with-jdk=/usr/lib/jvm/java-6-openjdk-armhf \
              --with-junit=/usr/share/java/junit.jar
else
  DH_OPTIONS += -Nlibsvn-java
  confflags += --disable-javahl
#endif

export DH_OPTIONS
#ifdef DEB_OPT_WITH_JAVAHL
  # jikes 1.22 cannot compile javahl.
  #confflags += --enable-javahl --without-jikes \
  #             --with-jdk=/usr/lib/jvm/java-6-openjdk-armhf \
  #            --with-junit=/usr/share/java/junit.jar
#else
  DH_OPTIONS += -Nlibsvn-java
  confflags += --disable-javahl
#endif

然后继续执行上面的命令,并且切换用户到user

$ chmod -R 777 root

$ chown -R user root/subversion-1.6.17dfsg

$ su -l user

$ cd root

$ cd subversion-1.6.17dfsg

$ dpkg-buildpackage -d -b -uc

以上为Subversion-1.6 Wheezy 版本的编译,如果要编译 Subversion-1.8 Jessie版本的话,还需要如下配置

1.用user用户登录

$ su -l user

2.删除Subversion-1.8 目录

$ cd root

$ rm -rf subversion-1.8.10

3.重新以低权限生成目录,如果不如此操作,会提示各种各样的权限不足。

$ apt-get -y source --compile subversion

4.返回root,并安装缺少的依赖库

$ exit

$ apt-get install libtool

5.修改debian/rules,禁止测试安装包,目前启用测试会失败。

# Set autoconf cross-compile mode correctly.
# Also disable testsuite if cross-compiling.
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  DEB_OPT_NOCHECK := 1
endif

修改为

# Set autoconf cross-compile mode correctly.
# Also disable testsuite if cross-compiling.
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
  DEB_OPT_NOCHECK := 1
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  DEB_OPT_NOCHECK := 1
endif

6.重新返回 user,执行编译。

$ su -l user

$ cd root

$ cd subversion-1.8.10

$ dpkg-buildpackage -d -b -uc
  • 编译 GCC 4.9

很遗憾的是Gcj,Ecj模块在ARM下面即使到了GCC-4.9都不能正常运行,运行的时候,直接卡死在运行界面上面,既不失败,也不返回,就是卡住比如安装 ecj-gcj 后在Shell 直接运行 ecj-gcj,连版本号都不能显示,就是卡住。

因此只能在ARM下面要求GCC不支持JAVA的编译,编译JAVA还是用OpenJDK 好了。

打开规则配置文件

$ nano /root/gcc-4.9-4.9.2/debian/rules.defs

修改

# Java --------------------
# - To build a standalone gcj package (with no corresponding gcc
# package): with_separate_libgcj=yes, with_standalone_gcj=yes
# - To build the java packages from the gcc source package:
# with_separate_libgcj=no, with_standalone_gcj=no
# - To build gcc and java from separate sources:
# with_separate_libgcj=yes, with_standalone_gcj=no

java_no_cpus := # arm64 mips mipsel
java_no_systems :=

ifneq ($(single_package),yes)
with_separate_libgcj := yes
endif
with_separate_libgcj := no
with_standalone_gcj := no

ifneq ($(separate_lang),yes)
with_java := yes
endif

# java converted for V3 C++ ABI for some archs
ifeq ($(with_base_only),yes)
with_java := no
endif
ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(java_no_cpus)))
with_java := disabled for cpu $(DEB_TARGET_ARCH_CPU)
endif
ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
with_java := disabled for system $(DEB_TARGET_GNU_SYSTEM)
endif
ifeq ($(java_no_cross)-$(DEB_CROSS),yes-yes)
with_java := disabled for cross compiler package
endif
with_java := $(call envfilt, java, , c++, $(with_java))

# Java --------------------
# - To build a standalone gcj package (with no corresponding gcc
# package): with_separate_libgcj=yes, with_standalone_gcj=yes
# - To build the java packages from the gcc source package:
# with_separate_libgcj=no, with_standalone_gcj=no
# - To build gcc and java from separate sources:
# with_separate_libgcj=yes, with_standalone_gcj=no

java_no_cpus := # arm64 mips mipsel
java_no_systems :=

ifneq ($(single_package),yes)
with_separate_libgcj := yes
endif
with_separate_libgcj := no
with_standalone_gcj := no

ifneq ($(separate_lang),yes)
with_java := yes
endif

# java converted for V3 C++ ABI for some archs
ifeq ($(with_base_only),yes)
with_java := no
endif
ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(java_no_cpus)))
with_java := disabled for cpu $(DEB_TARGET_ARCH_CPU)
endif
ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
with_java := disabled for system $(DEB_TARGET_GNU_SYSTEM)
endif
ifeq ($(java_no_cross)-$(DEB_CROSS),yes-yes)
with_java := disabled for cross compiler package
endif
with_java := $(call envfilt, java, , c++, $(with_java))

with_java := no

也就是在最后面增加

with_java := no

去掉JAVA模块,然后重新编译即可。

  • 编译最新的 aria2

编译最新的Jessie版本的 aria2,如果使用 Jessie 的编译环境编译,则编译出来的程序依赖了gcc-4.9 导致libc6的升级,一旦 libc6升级,则系统立即崩溃,因此编译方法为把64k-Jessie 下面的文件夹拷贝到 64k-wheezy目录下面然后编译即可。

$ cp -r ~/wdmc-build/64k-jessie/build/root/aria2-1.18.8 ~/wdmc-build/64k-wheezy/build/root/aria2-1.18.8 

$ cd ~/wdmc-build/64k-wheezy

$ chroot build

$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts

$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd /root/aria2-1.18.8

$ dpkg-buildpackage -d -b -uc
  • 编译 PHP5

编译PHP5的时候,会出现卡住在 stop mysqld 的问题,此时应该新开一个shell,然后手工杀掉mysql服务,貌似是编译程序没办法停止mysql,只能是手工处理,杀掉后,编译进程就可以正常继续了。

$ cd ~/wdmc-build/64k-wheezy

$ chroot build

$ ps -A | grep "mysql"
 9806 pts/0    00:00:00 mysql-server-5.
 10243 pts/0    00:00:55 mysqld

$ kill -9 9806

$ kill -9 10243
  • 编译 update-inetd

编译update-inetd-4.43的时候,总是失败,卡住在

debconf-updatepo
qemu: uncaught target signal 11 (Segmentation fault)

因此需要注释掉 debconf-updatepo

$ cd ~/wdmc-build/64k-wheezy/build/root/update-inetd-4.43

$ sudo vim rules

修改

clean:
	dh_testdir
	dh_testroot
	debconf-updatepo
	dh_clean

clean:
	dh_testdir
	dh_testroot
	#debconf-updatepo
	dh_clean

然后重新编译即可。

  • 编译 git-2.1.4

编译最新的Jessie版本的 git-2.1.4,(git版本低于1.8的服务器存在一个当大量文件被pull到服务器会出现内存峰值导致内存不足而提交失败的BUG),如果使用 Jessie 的编译环境编译,则编译出来的程序依赖了gcc-4.9 导致libc6的升级,一旦 libc6升级,则系统立即崩溃,因此编译方法为把64k-Jessie 下面的文件夹拷贝到 64k-wheezy目录下面然后编译即可。

$ sudo cp -r ~/wdmc-build/64k-jessie/build/root/git-2.1.4 ~/wdmc-build/64k-wheezy/build/root/git-2.1.4 

$ cd ~/wdmc-build/64k-wheezy

$ sudo chroot build

$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts

$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ apt-get install libpcre3-dev

$ cd /root/git-2.1.4

$ dpkg-buildpackage -d -b -uc

需要注意的是libpcre3-dev的开发包安装语句

$ apt-get install libpcre3-dev

否则会提示如下错误:

In file included from revision.h:5:0,
from bisect.c:4:
grep.h:5:18: fatal error: pcre.h: No such file or directory
compilation terminated.
make[1]: *** [bisect.o] Error 1
make[1]: Leaving directory `/root/git-2.1.4'
make: *** [build-arch-stamp] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
  • 编译 git-lfs
$ cd ~/wdmc-build/64k-wheezy

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo chroot build

$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts

$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

# 安装依赖
$ apt-get update
$ apt-get upgrade
$ apt-get install golang
$ apt-get install dh-golang

$ cd root

$ git clone https://github.com/git-lfs/git-lfs.git

$ cd git-lfs

$ dpkg-buildpackage -d -b -uc
  • 编译 amule

amule默认编译的时候是包含GUI界面的,但是WD MyCloud是用不到界面的,实际上GTK+部分目前也没办法编译通过。
首先,执行一次编译,让脚本自动把需要的依赖安装配置完成,方便我们的后续处理

$ cd ~/wdmc-build/64k-wheezy

$ su

$ ./build.sh amule

amule编译完成后,把依赖的wxWidgets2.8等依赖库编译完成后,只能安装命令行版本的amule,安装命令如下:

$ apt-get install amule-daemon
  • 编译 nut-2.7.2

ups不间断电源网络服务

$ cd ~/wdmc-build/64k-wheezy
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root
$ mkdir nut-2.7.2
$ cd nut-2.7.2
$ wget http://deb.debian.org/debian/pool/main/n/nut/nut_2.7.2-4.dsc
$ wget http://deb.debian.org/debian/pool/main/n/nut/nut_2.7.2.orig.tar.gz
$ wget http://deb.debian.org/debian/pool/main/n/nut/nut_2.7.2-4.debian.tar.xz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nut_2.7.2-4.dsc
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nut_2.7.2.orig_.tar.gz -O nut_2.7.2.orig.tar.gz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nut_2.7.2-4.debian.tar.xz

$ tar xzvf nut_2.7.2.orig.tar.gz

$ tar xvf nut_2.7.2-4.debian.tar.xz  -C nut-2.7.2/

$ cd nut-2.7.2

$ dpkg-buildpackage -d -b -uc

如果发生如下错误:

dh_installman -pnut-server  
debian/tmp/usr/share/man/man8/bcmxcp_usb.8: No such file or directory at /usr/bin/dh_installman line 128, <IN> line 60.
make: *** [binary-install/nut-server] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/bcmxcp_usb.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/richcomm_usb.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/tripplite_usb.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/usbhid-ups.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/blazer_usb.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/nutdrv_atcl_usb.8/d" debian/nut-server.manpages

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/riello_usb.8/d" debian/nut-server.manpages

如果发生如下错误:

dh_install: nut-server missing files (debian/tmp/*/udev/rules.d/52-nut-usbups.rules), aborting
make: *** [binary-install/nut-server] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/\*\/udev\/rules.d\/52-nut-usbups.rules/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/debian\/tmp\/lib\/nut\/usbhid-ups/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/usbhid-ups/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/blazer_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/debian\/tmp\/lib\/nut\/tripplite_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/tripplite_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/bcmxcp_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/richcomm_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/nutdrv_atcl_usb/d" debian/nut-server.install

$ sed -i "/^debian\/tmp\/lib\/nut\/riello_usb/d" debian/nut-server.install

如果发生如下错误:

dh_installman -pnut-snmp  
debian/tmp/usr/share/man/man8/snmp-ups.8: No such file or directory at /usr/bin/dh_installman line 128.
make: *** [binary-install/nut-snmp] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/snmp-ups.8/d" debian/nut-snmp.manpages

如果发生如下错误:

dh_install -pnut-snmp  
/bin/cp: cannot stat `debian/tmp/debian/tmp/lib/nut/snmp-ups': No such file or directory
dh_install: cp -a debian/tmp/debian/tmp/lib/nut/snmp-ups debian/nut-snmp//lib/nut/ returned exit code 1
make: *** [binary-install/nut-snmp] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/lib\/nut\/snmp-ups/d" debian/nut-snmp.install

如果发生如下错误:

dh_installman -pnut-ipmi  
debian/tmp/usr/share/man/man8/nut-ipmipsu.8: No such file or directory at /usr/bin/dh_installman line 128.
make: *** [binary-install/nut-ipmi] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/nut-ipmipsu.8/d" debian/nut-ipmi.manpages

如果发生如下错误:

dh_install -pnut-ipmi  
/bin/cp: cannot stat `debian/tmp/debian/tmp/lib/nut/nut-ipmipsu': No such file or directory
dh_install: cp -a debian/tmp/debian/tmp/lib/nut/nut-ipmipsu debian/nut-ipmi//lib/nut/ returned exit code 1
make: *** [binary-install/nut-ipmi] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/lib\/nut\/nut-ipmipsu/d" debian/nut-ipmi.install

$ sed -i "/^debian\/tmp\/\*\/udev\/rules.d\/52-nut-ipmipsu.rules/d" debian/nut-ipmi.install

如果发生如下错误:

dh_installman -pnut-xml  
debian/tmp/usr/share/man/man8/netxml-ups.8: No such file or directory at /usr/bin/dh_installman line 128.
make: *** [binary-install/nut-xml] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/netxml-ups.8/d" debian/nut-xml.manpages

如果发生如下错误:

dh_install -pnut-xml  
/bin/cp: cannot stat `debian/tmp/debian/tmp/lib/nut/netxml-ups': No such file or directory
dh_install: cp -a debian/tmp/debian/tmp/lib/nut/netxml-ups debian/nut-xml//lib/nut/ returned exit code 1
make: *** [binary-install/nut-xml] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/lib\/nut\/netxml-ups/d" debian/nut-xml.install

如果发生如下错误:

dh_installexamples -pnut-powerman-pdu 
dh_installman -pnut-powerman-pdu  
debian/tmp/usr/share/man/man8/powerman-pdu.8: No such file or directory at /usr/bin/dh_installman line 128.
make: *** [binary-install/nut-powerman-pdu] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/usr\/share\/man\/man8\/powerman-pdu.8/d" debian/nut-powerman-pdu.manpages

如果发生如下错误:

dh_bugfiles -pnut-powerman-pdu 
dh_install -pnut-powerman-pdu  
/bin/cp: cannot stat `debian/tmp/debian/tmp/lib/nut/powerman-pdu': No such file or directory
dh_install: cp -a debian/tmp/debian/tmp/lib/nut/powerman-pdu debian/nut-powerman-pdu//lib/nut/ returned exit code 1
make: *** [binary-install/nut-powerman-pdu] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2

执行如下命令修复后重新编译:

$ sed -i "/^debian\/tmp\/lib\/nut\/powerman-pdu/d" debian/nut-powerman-pdu.install
  • 编译 libnspr4-4.12
$ cd ~/wdmc-build/64k-wheezy
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root
$ mkdir nspr_4.12
$ cd nspr_4.12

$ wget http://deb.debian.org/debian/pool/main/n/nspr/nspr_4.12-1+debu8u1.dsc
$ wget http://deb.debian.org/debian/pool/main/n/nspr/nspr_4.12.orig.tar.gz
$ wget http://deb.debian.org/debian/pool/main/n/nspr/nspr_4.12-1+debu8u1.debian.tar.xz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nspr_4.12-1debu8u1.dsc -O nspr_4.12-1+debu8u1.dsc
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nspr_4.12-1debu8u1.debian.tar.xz -O nspr_4.12-1+debu8u1.debian.tar.xz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nspr_4.12.orig_.tar.gz -O nspr_4.12.orig.tar.gz

$ tar xzvf nspr_4.12.orig.tar.gz

$ tar xvf nspr_4.12-1+debu8u1.debian.tar.xz -C nspr-4.12/

$ cd nspr-4.12/

$ dpkg-buildpackage -d -b -uc
  • 编译 libnss3-3.26
# 64k-wheezy 的gcc 版本只有4.6,无法编译通过,需要更高版本的GCC 
$ cd ~/wdmc-build/64k-jessie
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root
$ mkdir nss_3.26
$ cd nss_3.26

$ wget http://security.debian.org/debian-security/pool/updates/main/n/nss/nss_3.26-1+debu8u4.dsc
$ wget http://security.debian.org/debian-security/pool/updates/main/n/nss/nss_3.26.orig.tar.gz
$ wget http://security.debian.org/debian-security/pool/updates/main/n/nss/nss_3.26-1+debu8u4.debian.tar.xz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nss_3.26-1debu8u4.dsc -O nss_3.26-1+debu8u4.dsc
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nss_3.26.orig_.tar.gz -O nss_3.26.orig.tar.gz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/nss_3.26-1debu8u4.debian.tar.xz -O nss_3.26-1+debu8u4.debian.tar.xz

$ tar xzvf nss_3.26.orig.tar.gz

$ tar xvf nss_3.26-1+debu8u4.debian.tar.xz -C nss-3.26/

$ cd nss-3.26/

$ dpkg-buildpackage -d -b -uc
  • 编译 tcp-wrappers-7.6
$ cd ~/wdmc-build/64k-wheezy
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root
$ mkdir tcp-wrappers
$ cd tcp-wrappers

$ wget http://deb.debian.org/debian/pool/main/t/tcp-wrappers/tcp-wrappers_7.6.q-25.dsc
$ wget http://deb.debian.org/debian/pool/main/t/tcp-wrappers/tcp-wrappers_7.6.q.orig.tar.gz
$ wget http://deb.debian.org/debian/pool/main/t/tcp-wrappers/tcp-wrappers_7.6.q-25.debian.tar.xz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/tcp-wrappers_7.6.q-25.dsc
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/tcp-wrappers_7.6.q.orig_.tar.gz -O tcp-wrappers_7.6.q.orig.tar.gz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/tcp-wrappers_7.6.q-25.debian.tar.xz

$ tar xzvf tcp-wrappers_7.6.q.orig.tar.gz

$ tar xvf tcp-wrappers_7.6.q-25.debian.tar.xz -C tcp_wrappers_7.6/

$ cd tcp_wrappers_7.6

$ dpkg-buildpackage -d -b -uc
  • 编译 apcupsd-3.14.12

ups不间断电源网络服务(需要先编译[tcp-wrappers-7.6])

$ cd ~/wdmc-build/64k-wheezy
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root
$ mkdir apcupsd
$ cd apcupsd

$ wget http://deb.debian.org/debian/pool/main/a/apcupsd/apcupsd_3.14.12-1.1.dsc
$ wget http://deb.debian.org/debian/pool/main/a/apcupsd/apcupsd_3.14.12.orig.tar.gz
$ wget http://deb.debian.org/debian/pool/main/a/apcupsd/apcupsd_3.14.12-1.1.diff.gz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/apcupsd_3.14.12-1.1.dsc
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/apcupsd_3.14.12-1.1.diff_.gz -O apcupsd_3.14.12-1.1.diff.gz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/apcupsd_3.14.12.orig_.tar.gz -O apcupsd_3.14.12.orig.tar.gz

$ gunzip -d -v apcupsd_3.14.12-1.1.diff.gz

$ tar xzvf apcupsd_3.14.12.orig.tar.gz

$ cd apcupsd-3.14.12

$ git apply ../apcupsd_3.14.12-1.1.diff

# libwrap0
$ dpkg --install libwrap0_7.6.q-25_armhf.deb

$ dpkg-buildpackage -d -b -uc
  • 编译 e2fsprogs-1.42.13
$ cd ~/wdmc-build/64k-wheezy
 
$ sudo chroot build
 
$ mount -t proc none /proc
$ mount -t devtmpfs none /dev
$ mount -t devpts none /dev/pts
 
$ export DEBIAN_FRONTEND=noninteractive
$ export DEBCONF_NONINTERACTIVE_SEEN=true
$ export LC_ALL=C
$ export LANGUAGE=C
$ export LANG=C
$ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'
$ export DEB_BUILD_OPTIONS=nocheck

$ cd root

$ wget https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/snapshot/e2fsprogs-1.42.13.tar.gz

$ wget http://security.debian.org/debian-security/pool/updates/main/e/e2fsprogs/e2fsprogs_1.42.12-2+deb8u2.debian.tar.xz

# 也可本站下载源代码
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/e2fsprogs-1.42.13.tar.gz
# wget https://www.mobibrw.com/wp-content/uploads/2014/09/e2fsprogs_1.42.12-2deb8u2.debian.tar.xz -O e2fsprogs_1.42.12-2+deb8u2.debian.tar.xz

$ tar xvf e2fsprogs-1.42.13.tar.gz

$ cp e2fsprogs_1.42.12-2+deb8u2.debian.tar.xz e2fsprogs-1.42.13/

$ cd e2fsprogs-1.42.13

# 删除代码中原有的debian编译文件,我们需要使用debian修改过的配置文件才能成功编译
$ rm -rf debian

$ tar xvf e2fsprogs_1.42.12-2+deb8u2.debian.tar.xz

# 安装依赖 "configure: error: external blkid library not found"
$ apt-get install libblkid-dev 

$ dpkg-buildpackage -d -b -uc

参考链接


GUIDE-Building-packages-for-the-new-firmware-someone-tried-it

发布者