pmt: fix some 2.3.0 missings

This commit is contained in:
2024-07-04 14:57:06 +03:00
parent 32ac3a3dd6
commit 934d1b0112
10 changed files with 225 additions and 9 deletions

91
README.md Executable file
View File

@@ -0,0 +1,91 @@
## Partition Manager (pmt)
This binary C is for manage partitions of android devices.
It offers a lot of options. I will place these below. But first let me talk about the operation...
#### Presented arguments (options)
```
Usage: pmt [OPTIONS] backup PARTITION [OUTPUT] [OPTIONS]...
or: pmt [OPTIONS] flash FILE PARTITION [OPTIONS]...
or: pmt [OPTIONS] format FILE_SYSTEM[ext/2/3/4] PARTITION [OPTIONS]...
Options:
-l, --logical It is meant to determine whether the target partition is logical.
-c, --context It is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name).
-p, --list List partitions.
-s, --silent Information and warning messages are silenced in normal work.
-f, --force Force mode. Some things are ignored.
-S, --set-lang Set current language.
-v, --version See version.
--help See this help message.
-L, --license See license.
Examples:
pmt backup boot_a -c /dev/block/platform/bootdevice/by-name
pmt flash /sdcard/twrp/boot.img boot_a -c /dev/block/platform/bootdevice/by-name
pmt format ext4 system_a --logical
pmt -c /dev/block/platform/bootdevice/by-name --list
Report bugs to <t.me/YZBruh>
```
#### Some notes
- Feel free to ask any questions you want.
- Packages are available in publications.
- If the logical partition flag is not used, a classic partition is tried to be processing by default.
- [Click to see special version changes](https://github.com/YZBruh/pbt/blob/2.3.0/CHANGELOG.md)
- Let me know your suggestions!
### How is it built?
Android NDK is required to build.
- [Download](https://developer.android.com/ndk/downloads) and extract the NDK package.
- Clone this repository. And get access to it.
```
git clone https://github.com/YZBruh/pbt -b 2.3.0 ./pmt
cd pmt
```
- Set the NDK working directory variable.
```
export NDK_PROJECT_PATH=$(pwd)
```
- Go to the NDK directory and start the construction
```
./ndk-build
```
- The output files will be inside the `pmt` folder. Binaries are available in two architectures within the `libs` folder. `arm64-v8a` (64-bit) and `armeabi-v7a` (32-bit).
```
pmt/
|
________________|________________
| | | |
jni/ debutils/ obj/ libs/
|
__________|__________
| |
arm64-v8a/ armeabi-v7a/
| |
pmt pmt
```
- For the make installable debian package make-deb.sh use the script. It can be created within two architectures. Use the script flags correctly: arm64-v8a, armeabi-v7a. If you want to process with root, add sudo as the second argument. If you don't want, use no-sudo or leave it blank
```
--Usage--
./make-deb.sh [arm64-v8a, armeabi-v7a] [sudo, no-sudo, <blank>]
```
```
chmod 777 utils.sh
# for making 64-bit package
./utils.sh make-deb arm64-v8a
# for making 32-bit package
./utils.sh make-deb armeabi-v7a
```
### Notes
If you want to change something, take a look at the configuration. You can change him.
it is located in the `jni/config` folder. His name is `env.mk`. I gave the information in the file. You can ask more.

View File

@@ -1,6 +1,6 @@
Source: pmt
Package: pmt
Version: 2.1.0
Version: 2.3.0
Architecture: arm
Description: pmt is for reading, writing and formatting partitions of android devices
Section: misc

View File

@@ -1,6 +1,6 @@
Source: pmt
Package: pmt
Version: 2.1.0
Version: 2.3.0
Architecture: aarch64
Description: pmt is for reading, writing and formatting partitions of android devices
Section: misc

View File

@@ -38,8 +38,17 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpmt_error
LOCAL_SRC_FILES := error.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := $(PMT_CFLAGS)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpmt_partitiontool
LOCAL_SRC_FILES := partition_tool.c
LOCAL_SRC_FILES := partitiontool.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := $(PMT_CFLAGS)
@@ -61,13 +70,13 @@ LOCAL_SRC_FILES := \
pmt.c \
versioner.c \
tools.c \
error.c \
lang_tools.c \
languages.c \
docs.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
libpmt_root \
libpmt_error \
libpmt_partitiontool \
libpmt_list
LOCAL_CFLAGS := $(PMT_CFLAGS)

102
jni/Makefile Executable file
View File

@@ -0,0 +1,102 @@
# By YZBruh
# Copyright 2024 Partition Manager
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#####
# sub-make for building package
#####
THIS_IS = src
include ../Makefile.inc
ifeq ($(INC_OLDENV),true)
include ../config/oldenv.mk
endif
define make_obj
$(eval OBJ := $(1:.c=.o))
$(call m_stat,`basename $(SOURCE_DIR)`/`basename $(OBJ)`)
$(CC) $(CFLAGS) -c $1 || exit 1;
endef
define make_executable
printf " - Making executable file...\n"; \
$(CC) $(CFLAGS) -L$(SOURCE_DIR) -lpmt_root -lpmt_lister -lpmt_partitiontool -o $(TARGET) pmt.o error.o docs.o versioner.o lang_tools.o languages.o || exit 1;
endef
define make_staticlib
$(call m_stat,$(1))
$(AR) rcs "$1" "$2" || exit 1;
endef
# all target for building
all:
@rm -f ../config/oldenv.mk; \
printf " ---- Partition Manager Builder ---- \n\n"; \
printf " - Version: $(VERSION)\n"; \
printf " - Version code: $(VERSION_CODE)\n\n"; \
printf " -------------------------------- \n\n"; \
abort_build() { \
if [ -d "$(PACKAGE_DIR)" ]; then \
rm -rf "$(PACKAGE_DIR)"; \
fi; \
if [ -d "$(BINARY_DIR)" ]; then \
rm -rf "$(BINARY_DIR)"; \
fi; \
if [ -d "$(STATICLIB_DIR)" ]; then \
rm -rf "$(STATICLIB_DIR)"; \
fi; \
exit 1; \
}; \
if [ -f $(SOURCE_DIR)/docs.o ]; then \
printf " - Please clean up before you build it.\n\n"; \
printf " ----------------------------------- \n"; \
exit 1; \
fi; \
printf " - Building objects...\n"; \
sleep 2; \
$(foreach csrc,$(SRCS),$(call make_obj, $(csrc)))
$(call mdir,$(OUT_DIR))
$(call mdir,$(BINARY_DIR))
$(call mdir,$(PACKAGE_DIR))
$(call mdir,$(STATICLIB_DIR))
printf " - Building static libraries...\n";
$(call make_staticlib,libpmt_root.a,root.o)
$(call make_staticlib,libpmt_lister.a,listpart.o)
$(call make_staticlib,libpmt_partitiontool.a,partition_tool.o)
sleep 1;
$(call make_executable)
sleep 1;
mv pmt $(BINARY_DIR) || abort_build; \
mv *.a $(STATICLIB_DIR) || abort_build; \
printf " - Generating xz package...\n"; \
cp $(BINARY_DIR)/pmt $(PACKAGE_DIR) || abort_build; \
xz $(PACKAGE_DIR)/pmt || abort_build; \
sleep 1; \
mv $(PACKAGE_DIR)/pmt.xz $(PACKAGE_DIR)/pmt-$(ARCH).xz || abort_build; \
printf " - Success\n\n"; \
sleep 1; \
printf " ----------------------------------- \n"
.PHONY: clean
clean:
$(eval STATICLIBS = $(wildcard $(SOURCE_DIR)/*.a))
$(eval OBJS = $(wildcard $(SOURCE_DIR)/*.o))
$(info Cleaning files...)
$(foreach obj,$(OBJS), $(call m_stat_nn,src/$(shell basename $(obj))) $(call erase,$(obj)))
$(foreach lib,$(STATICLIBS),$(call m_stat_nn,src/$(shell basename $(lib))) $(call erase,$(lib)))
# end

View File

@@ -18,6 +18,20 @@
__BEGIN_DECLS
#include <android/ndk-version.h>
#if __NDK_MINOR__ == 1
#define __NDK_MINOR_STATUS__ "b"
#else
#define __NDK_MINOR_STATUS__ ""
#endif
#if __NDK_BETA__ == 1 || __NDK_BETA__ == 2
#define __NDK_BETA_STATUS__ "beta"
#else
#define __NDK_BETA_STATUS__ ""
#endif
/* versioning */
#define PMT_MAJOR 2
#define PMT_MINOR 3

View File

@@ -43,7 +43,7 @@ struct pmt_langdb_general en = {
.expected_flash_arg = "Expected flash argument 2, retrieved",
.expected_format_arg = "Expected format argument 2, retrieved",
.missing_operand = "missing operand",
.multiple_wiewers = "Multiple wiewers cannot be used at the same line.",
.multiple_wiewers = "Multiple viewers cannot be used at the same line.",
.common_symbol_rule = "When entering the attached argument of an option, an argument of another option type cannot be used. In short, the rule is: there can be no '-' at the beginning of the attached argument.",
.req_part_name = "Required partition name.",
.part_not_found = "Partition not found!",
@@ -155,7 +155,7 @@ struct pmt_langdb_docs tr_docs = {
.docs_strs_l2 = "[SEÇENEKLER] flash DOSYA BÖLÜM [SEÇENEKLER]...",
.docs_strs_l3 = "[SEÇENEKLER] format DOSYA_SİSTEMİ[ext/2/3/4] BÖLÜM [SEÇENEKLER]...",
.docs_strs_l4 = "Seçenekler",
.docs_strs_l5 = "Bu seçeneği kullanarak mantıksal (logical) bir bölümün yedekleneceğini belirtebilirsiniz.",
.docs_strs_l5 = "Bu seçeneği kullanarak mantıksal (logical) bir bölümle işlem yapılacağını belirtebilirsiniz.",
.docs_strs_l6 = "Bu seçeneği kullanarak özel /dev bağlamı belirtebilirsiniz. Sadece normal (mantıksal olmayan) bölümler içindir (Varsayılan: /dev/block/by-name).",
.docs_strs_l7 = "Bölümler listelenir.",
.docs_strs_l8 = "Bilgi ve uyarı mesajları susturulur.",

View File

@@ -231,7 +231,7 @@ int main(int argc, char* argv[])
return 1;
break;
default:
printf("%s: %s [backup] flash] [format] [-l | --logical] [-c | --context] [-D | --list] [-v | --version] [--help] [-L | --license]\n", current->usage_head, argv[0]);
printf("%s: %s [backup] [flash] [format] [-l | --logical] [-c | --context] [-D | --list] [-v | --version] [--help] [-L | --license]\n", current->usage_head, argv[0]);
return 1;
}
}

View File

@@ -44,7 +44,7 @@ void version(void)
#endif
#if defined(__clang__)
printf("%s: clang %d.%d.%d\n", current->compiler_str, __clang_major__, __clang_minor__, __clang_patchlevel__);
printf("%s: clang %d.%d.%d (NDK r%d%s %s)\n", current->compiler_str, __clang_major__, __clang_minor__, __clang_patchlevel__, __NDK_MAJOR__, __NDK_MINOR_STATUS__, __NDK_BETA_STATUS__);
#endif
printf("%s\n", current->see_license);
@@ -54,4 +54,4 @@ void version(void)
}
#endif
/* end of code */
/* end of code */