From c2b1f05d6fa469855da5000ff5e5261e87a08447 Mon Sep 17 00:00:00 2001 From: Jacek Kryszyn Date: Thu, 21 Sep 2023 12:59:44 +0200 Subject: [PATCH] README.md updated --- README.md | 42 ++++++++++++++++++++++++++++++------------ make.sh | 2 +- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9ecaf12..9aa4a3d 100755 --- a/README.md +++ b/README.md @@ -2,29 +2,47 @@ Original project: https://github.com/LonelyFool/lpunpack_and_lpmake Copied from commit 7ec860cfa95ed83dec579ab0459aad1c35ad48e4 # lpunpack and lpmake -To compile x86_64 you need: -- clang (sudo apt install clang) -- zlib (sudo apt install zlib1g-dev) -To cross-compile you need: -- Ubuntu 22.04: `crossbuild-essential-arm64`/`crossbuild-essential-armel`/`crossbuild-essential-armhf` (sudo apt install $package). -- Ubuntu 20.04: `sudo apt install gcc-10-aarch64-linux-gnu` and `sudo apt install g++-aarch64-linux-gnu` +It is not possible to build this project on Ubuntu 20.04 using gcc 9.x due to an internal compiler error: -On Ubuntu 20.04 `crossbuild-essential-arm64`` uses gcc 9.x which gives an internal error during build. This is why gcc-10 version has to be installed explicitly. +``` +In file included from $project_path/lib/base/logging.cpp:64: +$project_path/lib/base/logging_splitters.h: In lambda function: +$project_path/lib/base/logging_splitters.h:82:79: internal compiler error: in expand_expr_real_1, at expr.c:10014 + 82 | en = snprintf(logd_chunk + chunk_position, sizeof(logd_chunk) - chunk_position, + | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ + +0x7f07e29ab082 __libc_start_main + ../csu/libc-start.c:308 +``` -`` -build: +This is why it is advised to use clang or gcc-10 on Ubuntu 20.04. + +## How to build + +CMake support was added to this project. You can build partition tools using ``` mkdir build cd build cmake ../ make +``` +or you can use the original make script: ``` +./make.sh +``` + This requires: +- clang (sudo apt install clang) +- zlib (sudo apt install zlib1g-dev) -or you can use original makefile: +## Cross-building +It is possible to cross-build using CMake. Simply invoke cmake with `-DCMAKE_TOOLCHAIN_FILE`: ``` -make -``` \ No newline at end of file +mkdir build && cd build +cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.make ../ +``` + +The project contains an exemplary `toolchain.make` file which uses `aarch64-linux-gnu-gcc` and `aarch64-linux-gnu-g++` to build for arm. \ No newline at end of file diff --git a/make.sh b/make.sh index bad817a..8dc0188 100755 --- a/make.sh +++ b/make.sh @@ -546,4 +546,4 @@ $STRIP bin/lpmake $STRIP bin/lpadd $STRIP bin/lpflash $STRIP bin/lpunpack -$STRIP bin/lpdump \ No newline at end of file +$STRIP bin/lpdump -- 2.7.4