Giter Site home page Giter Site logo

yuzukitsuru / openixcard Goto Github PK

View Code? Open in Web Editor NEW
152.0 5.0 22.0 28.93 MB

Open Source Version of Allwinner PhoenixCard to Dump, Unpack, Flash Allwinner IMG Files on Linux

License: GNU General Public License v2.0

C 51.12% CMake 1.16% C++ 7.09% Makefile 20.81% Shell 16.39% M4 3.42%
allwinner allwinner-soc disk-image embedded-systems filesystem embedded-linux

openixcard's Introduction

OpenixCard

Open Source Version of Allwinner PhoenixCard to Dump, Unpack, Flash Allwinner IMG Files on Linux

forthebadge forthebadge forthebadge forthebadge

CMake

Usage

 _____             _     _____           _ 
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| 
Copyright (c) 2022, YuzukiTsuru <[email protected]>

Usage: OpenixCard [options] input 

Positional arguments:
input           Input image file or directory path [required]

Optional arguments:
-h --help       shows help message and exits [default: false]
-v --version    prints version information and exits [default: false]
-u --unpack     Unpack Allwinner Image to folder [default: false]
-d --dump       Convert Allwinner image to regular image [default: false]
-c --cfg        Get Allwinner image partition table cfg file (use together with unpack) [default: false]
-p --pack       pack dumped Allwinner image to regular image from folder (needs cfg file) [default: false]
-s --size       Get the accurate size of Allwinner image [default: false]

eg.:
OpenixCard -u  <img>   - Unpack Allwinner image to target
OpenixCard -uc <img>   - Unpack Allwinner image to target and generate Allwinner image partition table cfg
OpenixCard -d  <img>   - Convert Allwinner image to regular image
OpenixCard -p  <dir>   - pack dumped Allwinner image to regular image from folder
OpenixCard -s  <img>   - Get the accurate size of Allwinner image

Download

ArchLinux

OpenixCard Now available at AUR #3

yay -S openixcard

Other Linux

You can find the new release file:
https://github.com/YuzukiTsuru/OpenixCard/releases

Build from source

# Download the source code
git clone --recursive --depth 1 https://github.com/YuzukiTsuru/OpenixCard

# Download the depends
sudo apt install cmake build-essential automake autoconf libconfuse-dev pkg-config

# Make build directory
mkdir build
cd build

# Make
cmake .. && make -j

Note: Ubuntu 20.04 compilation will report an error, This is caused by the bug of ar, you can compile and install the new version.

sudo apt-get install texinfo

wget https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz && \
  tar xvf binutils-2.38.tar.xz && \
  cd binutils-2.38 && \
  ./configure --prefix=/usr/local && \
  make
  
sudo make install

LICENSE

GNU GENERAL PUBLIC LICENSE Version 2, June 1991
                       
Copyright (c) 2022, YuzukiTsuru <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.

See README and LICENSE for more details.

openixcard's People

Contributors

ctag avatar ithamar avatar racethemase avatar yuzukitsuru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

openixcard's Issues

Unable to repackage

# ./OpenixCard -uc ./tina_v851se-perf1_uart0_nor1.img
 _____             _     _____           _
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: 07d9317 Commit: 281
Copyright (c) 2022, YuzukiTsuru <[email protected]>

[OpenixCard INFO] Converting input file: ./tina_v851se-perf1_uart0_nor1.img
[OpenixIMG INFO] Decrypting IMG header...
[OpenixIMG INFO] IMG version is: 0x300
[OpenixIMG INFO] Decrypting IMG file contents...
[OpenixIMG INFO] Writing the IMG config data...
[OpenixCard INFO] Unpack Done! Your image file is at ./tina_v851se-perf1_uart0_nor1.img.dump
[OpenixCard INFO] Parse Done! Your cfg file is at ./tina_v851se-perf1_uart0_nor1.img.dump/tina_v851se-perf1_uart0_nor1.cfg

# ./OpenixCard -p ./tina_v851se-perf1_uart0_nor1.img.dump
 _____             _     _____           _
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: 07d9317 Commit: 281
Copyright (c) 2022, YuzukiTsuru <[email protected]>

[OpenixCard INFO] Generating target image...
[GenIMG INFO]: cmd: "rm -rf "/tmp/tmp.SpMFPg8i78"/*"
[GenIMG INFO]: cmd: "mkdir -p "/tmp/tmp.SpMFPg8i78""
[GenIMG INFO]: cmd: "cp -a "/tmp/tmp.9crVdbQLeg" "/tmp/tmp.SpMFPg8i78/root""
[GenIMG INFO]: cmd: "find '/tmp/tmp.SpMFPg8i78/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/tmp/tmp.9crVdbQLeg/{}' '/tmp/tmp.SpMFPg8i78/root/{}'"
[GenIMG ERROR]: hdimage(tina_v851se-perf1_uart0_nor1.img): no partition with partition-type but hybrid partition-table-type selected
[GenIMG INFO]: cmd: "rm -rf "/tmp/tmp.SpMFPg8i78"/*"
[OpenixCard ERROR] Generate image failed!

I extracted and repackaged without modification, but encountered the following error. Is this a problem with my usage?

tina_v851se-perf1_uart0_nor1.zip

initcpp failed to build

[ 11%] Building CXX object CMakeFiles/inicpp.dir/src/string_utils.cpp.o In file included from /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/string_utils.h:6, from /home/tttt/.cache/yay/openixcard/src/inicpp/src/string_utils.cpp:1: /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:57: warning: unnecessary parentheses in declaration of ‘uint64_t’ [-Wparentheses] 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~~~ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:57: note: remove parentheses 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~~~ | - - /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:30: error: only declarations of constructors and conversion operators can be ‘explicit’ 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:58: error: field ‘uint64_t’ has incomplete type ‘inicpp::internal_enum_type’ 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:15:15: note: definition of ‘class inicpp::internal_enum_type’ is not complete until the closing brace 15 | class internal_enum_type | ^~~~~~~~~~~~~~~~~~ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:101:32: error: ‘uint64_t’ does not name a type 101 | using unsigned_ini_t = uint64_t; | ^~~~~~~~ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:8:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 7 | #include <variant> +++ |+#include <cstdint> 8 | /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:107:59: error: ‘unsigned_ini_t’ was not declared in this scope; did you mean ‘signed_ini_t’? 107 | std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>; | ^~~~~~~~~~~~~~ | signed_ini_t /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:107:112: error: template argument 3 is invalid 107 | std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>; | ^ /home/tttt/.cache/yay/openixcard/src/inicpp/include/inicpp/string_utils.h:125:40: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’? 125 | template <> INICPP_API unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name); | ^~~~~~~~~~~~~~ | signed_ini_t /home/tttt/.cache/yay/openixcard/src/inicpp/src/string_utils.cpp:124:17: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’? 124 | unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name) | ^~~~~~~~~~~~~~ | signed_ini_t make[2]: *** [CMakeFiles/inicpp.dir/build.make:174: CMakeFiles/inicpp.dir/src/string_utils.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/inicpp.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

Error installing using yay

Steps to reproduce:
yay -S openixcard

Error:

warning: could not open directory 'pkg/': Permission denied
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/openixcard-1.1.0'...
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/ColorCout'...
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/argparse'...
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/cpp-subprocess'...
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/FTXUI'...
Cloning into bare repository '/home/jlcarveth/.cache/yay/openixcard/inicpp'...
    openixcard-1.1.0 ... Skipped
    ColorCout ... Skipped
    argparse ... Skipped
    cpp-subprocess ... Skipped
    FTXUI ... Skipped
    inicpp ... Skipped
    openixcard-1.1.0 ... Skipped
    ColorCout ... Skipped
    argparse ... Skipped
    cpp-subprocess ... Skipped
    FTXUI ... Skipped
    inicpp ... Skipped
Cloning into 'openixcard-1.1.0'...
done.
Switched to a new branch 'makepkg'
Cloning into 'ColorCout'...
done.
Cloning into 'argparse'...
done.
Cloning into 'cpp-subprocess'...
done.
Cloning into 'FTXUI'...
done.
Cloning into 'inicpp'...
done.
Submodule 'lib/ColorCout' (https://github.com/YuzukiTsuru/ColorCout) registered for path 'lib/ColorCout'
Submodule 'lib/argparse' (https://github.com/p-ranav/argparse) registered for path 'lib/argparse'
Submodule 'lib/cpp-subprocess' (https://github.com/arun11299/cpp-subprocess) registered for path 'lib/cpp-subprocess'
Submodule 'lib/ftxui' (https://github.com/ArthurSonzogni/FTXUI) registered for path 'lib/ftxui'
Submodule 'lib/inicpp' (https://github.com/SemaiCZE/inicpp) registered for path 'lib/inicpp'
Cloning into '/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/ColorCout'...
done.
Cloning into '/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/argparse'...
done.
Cloning into '/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/cpp-subprocess'...
done.
Cloning into '/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/ftxui'...
done.
Cloning into '/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp'...
done.
==> WARNING: Using existing $srcdir/ tree
In file included from /home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/string_utils.h:6,
                 from /home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/src/string_utils.cpp:1:
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:46:57: warning: unnecessary parentheses in declaration of ‘uint64_t’ [-Wparentheses]
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                         ^~~~~~~~~~
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:46:57: note: remove parentheses
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                         ^~~~~~~~~~
      |                                                         -        -
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:46:30: error: only declarations of constructors and conversion operators can be ‘explicit’
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                              ^~~~~~~~
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:46:58: error: field ‘uint64_t’ has incomplete type ‘inicpp::internal_enum_type’
   46 |                 [[noreturn]] explicit internal_enum_type(uint64_t) : data_()
      |                                                          ^~~~~~~~
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:15:15: note: definition of ‘class inicpp::internal_enum_type’ is not complete until the closing brace
   15 |         class internal_enum_type
      |               ^~~~~~~~~~~~~~~~~~
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:101:32: error: ‘uint64_t’ does not name a type
  101 |         using unsigned_ini_t = uint64_t;
      |                                ^~~~~~~~
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:8:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    7 | #include <variant>
  +++ |+#include <cstdint>
    8 | 
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:107:59: error: ‘unsigned_ini_t’ was not declared in this scope; did you mean ‘signed_ini_t’?
  107 |                 std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>;
      |                                                           ^~~~~~~~~~~~~~
      |                                                           signed_ini_t
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/types.h:107:112: error: template argument 3 is invalid
  107 |                 std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>;
      |                                                                                                                ^
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/include/inicpp/string_utils.h:125:40: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’?
  125 |                 template <> INICPP_API unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name);
      |                                        ^~~~~~~~~~~~~~
      |                                        signed_ini_t
/home/jlcarveth/.cache/yay/openixcard/src/openixcard-1.1.0/lib/inicpp/src/string_utils.cpp:123:17: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’?
  123 |                 unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name)
      |                 ^~~~~~~~~~~~~~
      |                 signed_ini_t
make[2]: *** [lib/inicpp/CMakeFiles/inicpp.dir/build.make:174: lib/inicpp/CMakeFiles/inicpp.dir/src/string_utils.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:240: lib/inicpp/CMakeFiles/inicpp.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: openixcard-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
openixcard - exit status 4

cmake .. report error

~/project/d1s/OpenixCard/build$ cmake ..
CMake Error at CMakeLists.txt:43 (add_subdirectory):
The source directory

/home/tom/project/d1s/OpenixCard/lib/inicpp

does not contain a CMakeLists.txt file.

CMake Error at CMakeLists.txt:44 (add_subdirectory):
The source directory

/home/tom/project/d1s/OpenixCard/lib/argparse

does not contain a CMakeLists.txt file.

CMake Error at CMakeLists.txt:45 (add_subdirectory):
The source directory

/home/tom/project/d1s/OpenixCard/lib/ftxui

does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!
See also "/home/tom/project/d1s/OpenixCard/build/CMakeFiles/CMakeOutput.log".
See also "/home/tom/project/d1s/OpenixCard/build/CMakeFiles/CMakeError.log".

Build fails on Ubuntu 20.04

$ make
[  7%] Built target rc6
[ 40%] Built target inicpp
[ 44%] Linking CXX static library libGenIMG.a
configure.ac:75: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:75: the top level
configure.ac:76: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:76: the top level
configure.ac:75: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
/usr/share/autoconf/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
/usr/share/autoconf/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
/usr/share/autoconf/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
/usr/share/autoconf/m4sugar/m4sh.m4:639: AS_IF is expanded from...
/usr/share/autoconf/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
/usr/share/autoconf/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:75: the top level
configure.ac:76: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
/usr/share/autoconf/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
/usr/share/autoconf/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
/usr/share/autoconf/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
/usr/share/autoconf/m4sugar/m4sh.m4:639: AS_IF is expanded from...
/usr/share/autoconf/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
/usr/share/autoconf/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:76: the top level
configure.ac:75: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:75: the top level
configure.ac:76: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:76: the top level
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether make supports nested variables... (cached) yes
checking for memset... yes
checking for setenv... yes
checking for strdup... yes
checking for strcasecmp... yes
checking for strerror... yes
checking for strstr... yes
checking for strtoull... yes
checking for inline... inline
checking for error_at_line... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for size_t... yes
checking for uint32_t... yes
checking whether to enable debugging... no
checking whether to hide internal symbols... yes
checking if gcc supports -Wl,--as-needed flag... yes
checking if gcc supports -Wl,--gc-sections flag... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for CONFUSE... yes
checking whether the compiler supports -fvisibility=hidden... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
configure.ac:75: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:75: the top level
configure.ac:76: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2672: _AC_LINK_IFELSE is expanded from...
../../lib/autoconf/general.m4:2689: AC_LINK_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
m4/attributes.m4:87: CC_CHECK_LDFLAGS is expanded from...
configure.ac:76: the top level
config.status: creating config.h
  CC       libgenimage_a-config.o
  CC       libgenimage_a-util.o
  CC       libgenimage_a-crc32.o
  CC       libgenimage_a-image-android-sparse.o
  CC       libgenimage_a-image-cpio.o
  CC       libgenimage_a-image-cramfs.o
  CC       libgenimage_a-image-ext2.o
  CC       libgenimage_a-image-file.o
  CC       libgenimage_a-image-fit.o
  CC       libgenimage_a-image-flash.o
  CC       libgenimage_a-image-hd.o
  CC       libgenimage_a-image-iso.o
  CC       libgenimage_a-image-jffs2.o
  CC       libgenimage_a-image-qemu.o
  CC       libgenimage_a-image-rauc.o
  CC       libgenimage_a-image-squashfs.o
  CC       libgenimage_a-image-tar.o
  CC       libgenimage_a-image-ubi.o
  CC       libgenimage_a-image-ubifs.o
  CC       libgenimage_a-image-vfat.o
  AR       libgenimage.a
ar: invalid option -- 'n'
Usage: ar [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       ar -M [<mri-script]
 commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]         - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  s            - act as ranlib
  t[O][v]      - display contents of the archive
  x[o]         - extract file(s) from the archive
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids (default)
  [U]          - use actual timestamps and uids/gids
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [O]          - display offsets of files in the archive
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
  --target=BFDNAME - specify the target object format as BFDNAME
  --output=DIRNAME - specify the output directory for extraction operations
 optional:
  --plugin <p> - load the specified plugin
 emulation options: 
  No emulation specific options
ar: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 srec symbolsrec verilog tekhex binary ihex plugin
make[4]: *** [Makefile:458: libgenimage.a] Error 1
make[3]: *** [Makefile:400: all] Error 2
make[2]: *** [src/GenIMG/CMakeFiles/GenIMG.dir/build.make:102: src/GenIMG/libGenIMG.a] Error 2
make[1]: *** [CMakeFiles/Makefile2:455: src/GenIMG/CMakeFiles/GenIMG.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

Code breaks when given absolute path as input

When given absolute path as input, dir_fopen in src/OpenixIMG/src/OpenixIMG.c:95 still adds "./" to outfn.

For example, the following command fails:

$ ./OpenixCard -d -i ~/sipeed/img/LicheeRV_Tina_hdmi_8723ds.img -o dd
 _____             _     _____           _ 
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: 3fb7953
Copyright (c) 2022, YuzukiTsuru <[email protected]>

[OpenixCard] Input file: /home/thebesttv/sipeed/img/LicheeRV_Tina_hdmi_8723ds.img Now converting...
[OpenixCard] Convert Done! Prasing the partition tables...
terminate called after throwing an instance of 'file_open_error'
  what():  Fail to open file: /home/thebesttv/sipeed/img/LicheeRV_Tina_hdmi_8723ds.img.dump/sys_partition.fex.
Aborted (core dumped)

outfn is prefixed with ./

diropen("/home/thebesttv/sipeed/img/LicheeRV_Tina_hdmi_8723ds.img.dump", "image.cfg", "wb")
  outfn: .//home/thebesttv/sipeed/img/LicheeRV_Tina_hdmi_8723ds.img.dump

initcpp failed to build

[ 11%] Building CXX object CMakeFiles/inicpp.dir/src/string_utils.cpp.o In file included from /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/string_utils.h:6, from /home/yarpry/.cache/yay/openixcard/src/inicpp/src/string_utils.cpp:1: /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:57: warning: unnecessary parentheses in declaration of ‘uint64_t’ [-Wparentheses] 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~~~ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:57: note: remove parentheses 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~~~ | - - /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:30: error: only declarations of constructors and conversion operators can be ‘explicit’ 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:46:58: error: field ‘uint64_t’ has incomplete type ‘inicpp::internal_enum_type’ 46 | [[noreturn]] explicit internal_enum_type(uint64_t) : data_() | ^~~~~~~~ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:15:15: note: definition of ‘class inicpp::internal_enum_type’ is not complete until the closing brace 15 | class internal_enum_type | ^~~~~~~~~~~~~~~~~~ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:101:32: error: ‘uint64_t’ does not name a type 101 | using unsigned_ini_t = uint64_t; | ^~~~~~~~ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:8:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 7 | #include <variant> +++ |+#include <cstdint> 8 | /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:107:59: error: ‘unsigned_ini_t’ was not declared in this scope; did you mean ‘signed_ini_t’? 107 | std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>; | ^~~~~~~~~~~~~~ | signed_ini_t /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/types.h:107:112: error: template argument 3 is invalid 107 | std::variant<boolean_ini_t, signed_ini_t, unsigned_ini_t, float_ini_t, enum_ini_t, string_ini_t>; | ^ /home/yarpry/.cache/yay/openixcard/src/inicpp/include/inicpp/string_utils.h:125:40: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’? 125 | template <> INICPP_API unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name); | ^~~~~~~~~~~~~~ | signed_ini_t /home/yarpry/.cache/yay/openixcard/src/inicpp/src/string_utils.cpp:124:17: error: ‘unsigned_ini_t’ does not name a type; did you mean ‘signed_ini_t’? 124 | unsigned_ini_t parse_string<unsigned_ini_t>(const std::string &value, const std::string &option_name) | ^~~~~~~~~~~~~~ | signed_ini_t make[2]: *** [CMakeFiles/inicpp.dir/build.make:174: CMakeFiles/inicpp.dir/src/string_utils.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/inicpp.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

How to use this to flash an SD-Card image to Onboard NAND?

Forgive me if this is a dumb question, but a solution wasn't obvious to me looking at the command line switches.

How would one take an SD image from https://github.com/johang/sd-card-images created like this:

wget http://dl.sd-card-images.johang.se/boots/2022-12-01/boot-pcduino3_nano.bin.gz
wget http://dl.sd-card-images.johang.se/debians/2022-12-12/debian-bookworm-armhf-eaha4y.bin.gz
zcat boot-pcduino3_nano.bin.gz debian-bookworm-armhf-eaha4y.bin.gz > sd-card.img

And convert sd-card.img into a format that it would flash onto the internal NAND of an AllWinner A20 when booted? (I have a PCDuino3 Nano)

Makefile:437: recipe for target 'libgenimage.a' failed

Compiled under ubuntu18.04, using gcc-8, cmake-3.14.
When compiling, an error is reported.
config.status: creating config.h CC libgenimage_a-config.o CC libgenimage_a-util.o CC libgenimage_a-crc32.o CC libgenimage_a-image-android-sparse.o CC libgenimage_a-image-cpio.o CC libgenimage_a-image-cramfs.o CC libgenimage_a-image-ext2.o CC libgenimage_a-image-file.o CC libgenimage_a-image-fit.o CC libgenimage_a-image-flash.o CC libgenimage_a-image-hd.o CC libgenimage_a-image-iso.o CC libgenimage_a-image-jffs2.o CC libgenimage_a-image-qemu.o CC libgenimage_a-image-rauc.o CC libgenimage_a-image-squashfs.o CC libgenimage_a-image-tar.o CC libgenimage_a-image-ubi.o CC libgenimage_a-image-ubifs.o CC libgenimage_a-image-vfat.o AR libgenimage.a ar: invalid option -- 'n' Usage: ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file... ar -M [<mri-script] commands: d - delete file(s) from the archive m[ab] - move file(s) in the archive p - print file(s) found in the archive q[f] - quick append file(s) to the archive r[ab][f][u] - replace existing or insert new file(s) into the archive s - act as ranlib t - display contents of archive x[o] - extract file(s) from the archive command specific modifiers: [a] - put file(s) after [member-name] [b] - put file(s) before [member-name] (same as [i]) [D] - use zero for timestamps and uids/gids (default) [U] - use actual timestamps and uids/gids [N] - use instance [count] of name [f] - truncate inserted file names [P] - use full path names when matching [o] - preserve original dates [u] - only replace files that are newer than current archive contents generic modifiers: [c] - do not warn if the library had to be created [s] - create an archive index (cf. ranlib) [S] - do not build a symbol table [T] - make a thin archive [v] - be verbose [V] - display the version number @<file> - read options from <file> --target=BFDNAME - specify the target object format as BFDNAME optional: --plugin <p> - load the specified plugin emulation options: No emulation specific options ar: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 plugin srec symbolsrec verilog tekhex binary ihex Makefile:437: recipe for target 'libgenimage.a' failed make[4]: *** [libgenimage.a] Error 1 Makefile:380: recipe for target 'all' failed make[3]: *** [all] Error 2 src/GenIMG/CMakeFiles/GenIMG.dir/build.make:98: recipe for target 'src/GenIMG/libGenIMG.a' failed make[2]: *** [src/GenIMG/libGenIMG.a] Error 2 CMakeFiles/Makefile2:409: recipe for target 'src/GenIMG/CMakeFiles/GenIMG.dir/all' failed make[1]: *** [src/GenIMG/CMakeFiles/GenIMG.dir/all] Error 2 Makefile:151: recipe for target 'all' failed make: *** [all] Error 2

编译错误

错误如下:
penixCard/src/GenIMG/GenIMG.cpp:13:10: fatal error: filesystem: 没有那个文件或目录
#include
^~~~~~~~~~~~
compilation terminated.

编译环境
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Problems with creating an image of android (alwinner)

Hi, friend! First of all, I want to thank you for your efforts in creating this program! But I'm having problems. I compiled your program from the sources for Fedora 36. When executing commands with the program, the problem is that I do not create a new image. Unfortunately, the program itself does not show errors, but I made a video in which this error is visible in the file manager. Please check out this video. It is possible that I am doing something wrong, but I watched a video in which this problem is not. I tried the program with several android images for orange pi (h3 and h616), but to no avail. Thanks
OpenixCard version for me:

[anton@cerebro OpenixCard]$ ./OpenixCard -v
 _____             _     _____           _ 
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: 3e34a8c
Copyright (c) 2022, YuzukiTsuru <[email protected]>

3e34a8c
openixcard.mp4

cubieboard4 (sunxi a80) gen sdcard img

I use cubieboard4 (sunxi a80), I generate a img from sdk, I need to use it to generate a sdcard image.
But I saw the below message, do I need to change anything?

[GenIMG ERROR]: file(boot_package.fex): stat(/home/nigel/opensource/OpenixCard/build/dist/sun9iw1p1_linux_cubieboard4.img.dump/boot_package.fex) failed: No such file or directory

Not Allwinner image

Tried unpack A13 board android image but got [OpenixCard ERROR] File: S101-A_2.4.10_120908-1.img is not Allwinner image.

> OpenixCard -u S101-A_2.4.10_120908-1.img
...
[OpenixCard INFO] Converting input file: S101-A_2.4.10_120908-1.img
[OpenixIMG INFO] Decrypting IMG header...
[OpenixIMG INFO] IMG version is: 0x462a224
[OpenixCard ERROR] File: S101-A_2.4.10_120908-1.img is not Allwinner image.

I can upload image to some file hosting (github won't allow 300MB) if you need that

Crash when `bin/genimage` is not placed in current working directory

当目前的工作目录下不存在 bin/genimage 时,OpenixCard 进行 dump 操作时将会出现问题并退出。

[[maybe_unused]] Genimage::Genimage(std::string config_path, std::string image_path, std::string output_path)
: config_path(std::move(config_path)), image_path(std::move(image_path)), output_path(std::move(output_path)) {
this->genimage_bin = std::filesystem::current_path() / "bin/genimage";
// generate blank.fex file for commented partition
generate_blank_fex();
// call genimage
run_genimage();
}

# camber @ Camber-Arch in /mnt/AOSC [10:33:27] C:130
$ OpenixCard -i 20211230_LicheeRV_debian_d1_hdmi_8723ds.img -d
 _____             _     _____           _ 
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: 4a1514b
Copyright (c) 2022, YuzukiTsuru <[email protected]>

[OpenixCard INFO] Input file: 20211230_LicheeRV_debian_d1_hdmi_8723ds.img Now converting...
[OpenixCard INFO] Convert Done! Prasing the partition tables...
[OpenixCard INFO] Prase Done! Generating target image...
terminate called after throwing an instance of 'subprocess::CalledProcessError'
  what():  execve failed : No such file or directory
[1]    122586 IOT instruction (core dumped)  OpenixCard -i 20211230_LicheeRV_debian_d1_hdmi_8723ds.img -d

当前,OpenixCard 仅会在当前目录下搜索 bin/genimage 可执行文件。这样的设计不便于将可执行文件放置在其他 PATH 目录下的用户使用,亦不便于发行版打包者对 OpenixCard 进行打包,将该项目使用包管理器管理。

一个理想的行为是在 PATH 环境变量所定义的目录下逐一搜索 genimage 并调用第一个找到的合法的可执行的 genimage 文件,亦可以允许用户手动指定 genimage 程序的位置。

Error: no partition with partition-type but hybrid partition-table-type selected

OpenixCard -d TF781-20221102161258-30dc4eebd8e98407b04d113fba9c077e-maizhelong_gc2093_nvp6158c_2xch_HWTA102601G01_1026_zlink_guoxing_gps_en_中性logo_4K_release_v2.img
 _____             _     _____           _
|     |___ ___ ___|_|_ _|     |___ ___ _| |
|  |  | . | -_|   | |_'_|   --| .'|  _| . |
|_____|  _|___|_|_|_|_,_|_____|__,|_| |___|
      |_| Version: d0a8a7e Commit: 244
Copyright (c) 2022, YuzukiTsuru <[email protected]>

[OpenixCard INFO] Input file: TF781-20221102161258-30dc4eebd8e98407b04d113fba9c077e-maizhelong_gc2093_nvp6158c_2xch_HWTA102601G01_1026_zlink_guoxing_gps_en_中性logo_4K_release_v2.img Now converting...
[OpenixIMG INFO] Now Decrypt IMG header...
[OpenixIMG INFO] The IMG version is: 0x300
[OpenixIMG INFO] Now Decrypt IMG file contents...
[OpenixIMG INFO] Writing the IMG config data...
[OpenixCard INFO] Convert Done! Prasing the partition tables...
[OpenixCard INFO] Prase Done! Generating target image...
[GenIMG INFO]: cmd: "rm -rf "/tmp/tmp.avRGDYE9po"/*"
[GenIMG INFO]: cmd: "mkdir -p "/tmp/tmp.avRGDYE9po""
[GenIMG INFO]: cmd: "cp -a "/tmp/tmp.I3xq96BhpY" "/tmp/tmp.avRGDYE9po/root""
[GenIMG INFO]: cmd: "find '/tmp/tmp.avRGDYE9po/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/tmp/tmp.I3xq96BhpY/{}' '/tmp/tmp.avRGDYE9po/root/{}'"
[GenIMG ERROR]: hdimage(TF781-20221102161258-30dc4eebd8e98407b04d113fba9c077e-maizhelong_gc2093_nvp6158c_2xch_HWTA102601G01_1026_zlink_guoxing_gps_en_中性logo_4K_release_v2.img): no partition with partition-type but hybrid partition-table-type selected
[GenIMG INFO]: cmd: "rm -rf "/tmp/tmp.avRGDYE9po"/*"
[OpenixCard INFO] Generate Done! Your image file at TF781-20221102161258-30dc4eebd8e98407b04d113fba9c077e-maizhelong_gc2093_nvp6158c_2xch_HWTA102601G01_1026_zlink_guoxing_gps_en_中性logo_4K_release_v2.img.dump.out Cleaning up...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.