Skip to content

Commit 38ceb9a

Browse files
arowsercdecker
authored andcommitted
update the raspiberry build process
1 parent 3006844 commit 38ceb9a

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

doc/INSTALL.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@ Build with:
248248
To cross-compile for Raspberry Pi
249249
--------------------
250250

251-
Obtain the [official Raspberry Pi toolchains](https://github.com/raspberrypi/tools). This document assumes compilation will occur towards the Raspberry Pi 3 (arm-linux-gnueabihf as of Mar. 2018). In addition, obtain and install cross-compiled versions of sqlite 3 and gmp.
251+
Obtain the [official Raspberry Pi toolchains](https://github.com/raspberrypi/tools).
252+
This document assumes compilation will occur towards the Raspberry Pi 3
253+
(arm-linux-gnueabihf as of Mar. 2018).
252254

253-
Depending on your toolchain location and target arch, source env variables will need to be set. They can be set from the command line as such:
255+
Depending on your toolchain location and target arch, source env variables
256+
will need to be set. They can be set from the command line as such:
254257

255258
export PATH=$PATH:/path/to/arm-linux-gnueabihf/bin
256259
# Change next line depending on specific Raspberry Pi device
@@ -262,16 +265,45 @@ Depending on your toolchain location and target arch, source env variables will
262265
export LD=$target_host-ld
263266
export STRIP=$target_host-strip
264267

265-
Install the `qemu-user` package. This will allow you to properly configure the build for the target device environment. Then, build with the following commands. (A 64-bit build system is assumed here.)
268+
Install the `qemu-user` package. This will allow you to properly configure the
269+
build for the target device environment.
270+
Config the arm elf interpreter prefix:
271+
272+
export QEMU_LD_PREFIX=/path/to/raspberry/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot/
266273

267-
make CC=gcc clean ccan/tools/configurator/configurator
268-
BUILD=x86_64 MAKE_HOST=arm-linux-gnueabihf make PIE=1 DEVELOPER=0 CONFIGURATOR_CC="arm-linux-gnueabihf-gcc -static" LDFLAGS="-L/path/to/gmp-and-sqlite/lib" CFLAGS="-std=gnu11 -I /path/to/gmp-and-sqlite/include -I . -I ccan -I external/libwally-core/src/secp256k1/include -I external/libsodium/src/libsodium/include -I external/jsmn -I external/libwally-core/include -I external/libbacktrace -I external/libbase58"
274+
Obtain and install cross-compiled versions of sqlite3, gmp and zlib:
269275

270-
The compilation will eventually fail due to a compile error in the `cdump` CCAN module. Recompile the module, and then re-run the make system.
276+
Download and build zlib:
277+
278+
wget https://zlib.net/zlib-1.2.11.tar.gz
279+
tar xvf zlib-1.2.11.tar.gz
280+
cd zlib-1.2.11
281+
./configure --prefix=$QEMU_LD_PREFIX
282+
make
283+
make install
284+
285+
Download and build sqlite3:
286+
287+
wget https://www.sqlite.org/2018/sqlite-src-3260000.zip
288+
unzip sqlite-src-3260000.zip
289+
cd sqlite-src-3260000
290+
./configure --enable-static --disable-readline --disable-threadsafe --disable-load-extension --host=$target_host --prefix=$QEMU_LD_PREFIX
291+
make
292+
make install
271293

272-
make clean -C ccan/ccan/cdump/tools
273-
make CC=gcc -C ccan/ccan/cdump/tools
274-
BUILD=x86_64 MAKE_HOST=arm-linux-gnueabihf make PIE=1 DEVELOPER=0 CONFIGURATOR_CC="arm-linux-gnueabihf-gcc -static" LDFLAGS="-L/path/to/gmp-and-sqlite/lib" CFLAGS="-std=gnu11 -I /path/to/gmp-and-sqlite/include -I . -I ccan -I external/libwally-core/src/secp256k1/include -I external/libsodium/src/libsodium/include -I external/jsmn -I external/libwally-core/include -I external/libbacktrace -I external/libbase58"
294+
Download and build gmp:
295+
296+
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
297+
tar xvf gmp-6.1.2.tar.xz
298+
cd gmp-6.1.2
299+
./configure --disable-assembly --prefix=$QEMU_LD_PREFIX
300+
make
301+
make install
302+
303+
Then, build c-lightning with the following commands:
304+
305+
./configure
306+
make
275307

276308
To compile for Armbian
277309
--------------------

0 commit comments

Comments
 (0)