Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7ebb92fcd | |||
| 3b36e1309d | |||
| 8dbc54f9fc | |||
| 4b4b53a080 | |||
| 09d9aa1ee6 | |||
| 171de34710 | |||
| 5e39fdcdc9 | |||
| fbb4822872 | |||
| 711319cce0 | |||
| 6dbf7acf3c | |||
| 287c75aa67 | |||
| 1835ecc1e0 | |||
| 8afbb2314c | |||
| 283346f522 | |||
| c46a65607b | |||
| dd6c1c9faf | |||
| 6ab211c1b3 | |||
| 372563fceb | |||
| 0b34fdbfd9 | |||
| a2aee5c5e8 | |||
| d3d6bfd244 | |||
| 97edfbc133 | |||
| b5d4c76b2d | |||
| 39b1e67f8e | |||
| 1ffd0f90be | |||
| b8a8b7ff8f | |||
| 848412e1cd |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,10 +1,9 @@
|
||||
#### Version 1.5.0 (code 150):
|
||||
- provide the recognition feature unknown flags to the assembly system
|
||||
- bring the flash feature
|
||||
- clean the unnecessary code (variables etc.)
|
||||
- provide a more modular code
|
||||
- go to the change named project (Partition backupper (pbt) to Partition Manager (pmt)
|
||||
#### Version 1.7.0 (code 170):
|
||||
- Force mode added
|
||||
- Compatibility with C++ compilers ensured
|
||||
- Code integrity fixed
|
||||
- Exit codes have meanings. Review the code to understand
|
||||
|
||||
| END OF VERSION 1.5.0 CHANGELOG |
|
||||
| END OF VERSION 1.7.0 CHANGELOG |
|
||||
|------------------------------------|
|
||||
|
||||
|
||||
46
Makefile
46
Makefile
@@ -1,8 +1,6 @@
|
||||
include mka/config.mk
|
||||
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 YZBruh - Partition Manager
|
||||
# Copyright 2024 YZBruh - Partition Backupper
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -16,29 +14,34 @@ include mka/config.mk
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# speficy
|
||||
VERSION := 1.5.0
|
||||
VERSION_CODE := 150
|
||||
include config/env.mk
|
||||
|
||||
# speficy {version}
|
||||
VERSION := 1.7.0
|
||||
VERSION_CODE := 170
|
||||
SOURCE_DIR := binary
|
||||
TARGET := pmt
|
||||
LANG := en
|
||||
ARCH := $(shell uname -m)
|
||||
CUR_DIR := $(shell pwd)
|
||||
|
||||
# code list
|
||||
# sources
|
||||
SRCS := $(SOURCE_DIR)/$(TARGET).c
|
||||
SRCS += $(SOURCE_DIR)/error.c
|
||||
SRCS += $(SOURCE_DIR)/checkers.c
|
||||
SRCS += $(SOURCE_DIR)/lister.c
|
||||
SRCS += $(SOURCE_DIR)/listpart.c
|
||||
SRCS += $(SOURCE_DIR)/flash.c
|
||||
SRCS += $(SOURCE_DIR)/backup.c
|
||||
SRCS += $(SOURCE_DIR)/docs.c
|
||||
|
||||
# objects
|
||||
OBJS := $(SOURCE_DIR)/$(TARGET).o
|
||||
OBJS += $(SOURCE_DIR)/error.o
|
||||
OBJS += $(SOURCE_DIR)/checkers.o
|
||||
OBJS += $(SOURCE_DIR)/lister.o
|
||||
OBJS += $(SOURCE_DIR)/listpart.o
|
||||
OBJS += $(SOURCE_DIR)/flash.o
|
||||
OBJS += $(SOURCE_DIR)/backup.o
|
||||
OBJS += $(SOURCE_DIR)/docs.o
|
||||
|
||||
OUT_DIR := $(CUR_DIR)/out
|
||||
BINARY_DIR := $(OUT_DIR)/binary
|
||||
@@ -48,10 +51,8 @@ PACKAGE_DIR := $(OUT_DIR)/package
|
||||
all:
|
||||
@printf " --- Building Partition Manager --- \n"; \
|
||||
printf "Version: $(VERSION)\n"; \
|
||||
printf "Version code: $(VERSION_CODE)\n"; \
|
||||
printf " \n"; \
|
||||
printf " ------------------------------------- \n"; \
|
||||
printf " \n"; \
|
||||
printf "Version code: $(VERSION_CODE)\n\n"; \
|
||||
printf " ------------------------------------- \n\n"; \
|
||||
printf "Starting build... Please waith.\n"; \
|
||||
sleep 2; \
|
||||
printf "Make running with silent mode...\n"; \
|
||||
@@ -97,9 +98,11 @@ help:
|
||||
printf " make clean ==> Clear files (Builded binaries are not deleted)\n"; \
|
||||
printf " make clean-all ==> Clear files (Builded binaries are deleted)\n"; \
|
||||
printf " make install-termux ==> If you are using termux, it installs the compiled pmt into termux. So it allows you to use it like a normal command.\n"; \
|
||||
printf " make uninstall-termux ==> If you are using termux, it uninstalls the compiled pmt into termux.\n"; \
|
||||
printf " make help ==> Display help message\n"; \
|
||||
printf " \n";
|
||||
|
||||
# installer
|
||||
.PHONY: install-termux
|
||||
install-termux:
|
||||
@if [ -f /data/data/com.termux/files/usr/bin/termux-open ]; then \
|
||||
@@ -109,8 +112,21 @@ install-termux:
|
||||
cp $(BINARY_DIR)/pmt /data/data/com.termux/files/usr/bin/pmt || exit 1; \
|
||||
chmod 777 /data/data/com.termux/files/usr/bin/pmt || exit 1; \
|
||||
printf " \n"; \
|
||||
printf "Success.\n"; \
|
||||
printf " \n"; \
|
||||
printf "Success.\n\n"; \
|
||||
else \
|
||||
printf "This function is only available on Termux Android devices using aarch64 (64-bit) and armv7l (32-bit)\n"; \
|
||||
fi
|
||||
|
||||
# uninstaller
|
||||
.PHONY: uninstall-termux
|
||||
uninstall-termux:
|
||||
@if [ -f /data/data/com.termux/files/usr/bin/termux-open ]; then \
|
||||
printf " ------------------------------------- \n"; \
|
||||
printf " pmt uninstaller \n"; \
|
||||
printf " ------------------------------------- \n"; \
|
||||
rm /data/data/com.termux/files/usr/bin/pmt || exit 1; \
|
||||
printf " \n"; \
|
||||
printf "Success.\n\n"; \
|
||||
else \
|
||||
printf "This function is only available on Termux Android devices using aarch64 (64-bit) and armv7l (32-bit)\n"; \
|
||||
fi
|
||||
|
||||
44
README.md
44
README.md
@@ -12,29 +12,26 @@ It offers a lot of options. I will place these below. But first let me talk abou
|
||||
#### Presented arguments (options)
|
||||
|
||||
```
|
||||
Usage (arguments):
|
||||
-b, --backup backup mode
|
||||
-f, --flash flash mode
|
||||
-p, --partition name of the partition to be backed up
|
||||
-l, --logical know that the partition that will be backed up is logical
|
||||
-o, --out (only backups) the output name of the backed-up partition (default: partition name)
|
||||
-d, --outdir (only backups) directory where the backup partition will be saved (default: /storage/emulated/0)
|
||||
-c, --context it is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name)
|
||||
-D, --list list partitions
|
||||
-v, --version see version
|
||||
-h, --help see help message
|
||||
-L, --license see license
|
||||
Usage:
|
||||
-b | --backup backup mode
|
||||
-F | --flash flash mode
|
||||
-p | --partition name of the partition to be backed up
|
||||
-l | --logical know that the partition that will be backed up is logical
|
||||
-o | --out (only backups) the output name of the backed-up partition (default: partition name)
|
||||
-d | --outdir (only backups) directory where the backup partition will be saved (default: /storage/emulated/0)
|
||||
-c | --context it is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name)
|
||||
-D | --list list partitions
|
||||
-f | --force force mode. Output is not produced. Even if it's a mistake. But if the target is not a mode, the error is given. If you want to work stable, it is important to specify this option first.
|
||||
-v | --version see version
|
||||
--help see help message
|
||||
-L | --license see license
|
||||
|
||||
Example 1:
|
||||
Examples:
|
||||
-b --partition boot_a -o boot_slot_a_image -d /sdcard/backup -c /dev/block/platform/bootdevice/by-name
|
||||
|
||||
Example 2:
|
||||
--flash /sdcard/twrp/boot.img -p boot_a -c /dev/block/platform/bootdevice/by-name
|
||||
|
||||
Example 3:
|
||||
-c /dev/block/platform/bootdevice/by-name --list
|
||||
|
||||
Report bugs to <xda-@YZBruh>
|
||||
Report bugs to <yagizzengin73@gmail.com>
|
||||
```
|
||||
|
||||
#### Some notes
|
||||
@@ -43,14 +40,14 @@ Report bugs to <xda-@YZBruh>
|
||||
- Packages are available in publications.
|
||||
- İt is mandatory to use the `-b` | `--backup` or `-f` | `--flash` and `-p` | `--partition` argument. After all, a partition name and progress type is required to be progress.
|
||||
- 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/1.5.0-en/CHANGELOG.md)
|
||||
- [Click to see special version changes](https://github.com/YZBruh/pbt/blob/1.7.0-en/CHANGELOG.md)
|
||||
- Let me know your suggestions!
|
||||
|
||||
### How is it built?
|
||||
Even termux is enough to build the pmt. Or you can compile it with linux if you want. NOTE: Use a custom gcc according to the architecture you want to compile.
|
||||
|
||||
If you want to change something, take a look at the configuration. You can change him.
|
||||
it is located in the `mka` folder. His name is `config.mk`. I gave the information in the file. You can ask more.
|
||||
it is located in the `config` folder. His name is `env.mk`. I gave the information in the file. You can ask more.
|
||||
|
||||
To build;
|
||||
```
|
||||
@@ -62,11 +59,12 @@ Special `make` commands (pbt offers :) ;
|
||||
--------- Partition Manager help ---------
|
||||
|
||||
Commands;
|
||||
make ==> Build Partition Backupper
|
||||
make ==> Build Partition Manager
|
||||
make clean ==> Clear files (Builded binaries are not deleted)
|
||||
make clean-all ==> Clear files (Builded binaries are deleted)
|
||||
make install-termux ==> If you are using termux, it installs the compiled pbt into termux. So it allows you to use it like a normal command.
|
||||
make install-termux ==> If you are using termux, it installs the compiled pmt into termux. So it allows you to use it like a normal command.
|
||||
make uninstall-termux ==> If you are using termux, it uninstalls the compiled pmt into termux.
|
||||
make help ==> Display help message
|
||||
```
|
||||
|
||||
I compiled it with termux :D. Why should I bother... I compiled it with `GCC 17.0.6`. You can look at the version with the viewing option :)
|
||||
I compiled it with termux :D. Why should I bother... I compiled it with `GCC 18.0.2` You can look at the version with the viewing option :)
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/common.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -26,18 +16,32 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
extern char *out;
|
||||
extern char *outdir;
|
||||
extern char *cust_cxt;
|
||||
extern bool use_logical;
|
||||
extern bool use_cust_cxt;
|
||||
extern bool pmt_use_logical;
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_force_mode;
|
||||
|
||||
/* backupper func */
|
||||
void backup(char *target_backup_partition, char *backup_partition_style)
|
||||
{
|
||||
static char backupper_path[200];
|
||||
if (strstr(backup_partition_style, "classic") != NULL) {
|
||||
if (use_cust_cxt) {
|
||||
if (pmt_use_cust_cxt) {
|
||||
sprintf(backupper_path, "%s/%s", cust_cxt, target_backup_partition);
|
||||
} else {
|
||||
sprintf(backupper_path, "/dev/block/by-name/%s", target_backup_partition);
|
||||
@@ -45,13 +49,19 @@ void backup(char *target_backup_partition, char *backup_partition_style)
|
||||
} else if (strstr(backup_partition_style, "logical") != NULL) {
|
||||
sprintf(backupper_path, "/dev/block/mapper/%s", target_backup_partition);
|
||||
} else {
|
||||
error("İnvalid partition type!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("İnvalid partition type!\n", 28);
|
||||
} else {
|
||||
exit(28);
|
||||
}
|
||||
}
|
||||
|
||||
if (access(backupper_path, F_OK) == -1) {
|
||||
error("Partition not found!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("Partition not found!\n", 29);
|
||||
} else {
|
||||
printf("Target partition: %s\nBackupping...\n", target_backup_partition);
|
||||
exit(29);
|
||||
}
|
||||
}
|
||||
|
||||
static char backupper_cmd[256];
|
||||
@@ -70,7 +80,11 @@ void backup(char *target_backup_partition, char *backup_partition_style)
|
||||
}
|
||||
|
||||
if (system(backupper_cmd) != 0) {
|
||||
error("Failed!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("Failed!\n", 99);
|
||||
} else {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
if (outdir != NULL) {
|
||||
if (out != NULL) {
|
||||
@@ -85,8 +99,11 @@ void backup(char *target_backup_partition, char *backup_partition_style)
|
||||
printf("%sSuccess. Output: /storage/emulated/0/%s.img%s\n", ANSI_GREEN, target_backup_partition, ANSI_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/common.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -26,16 +16,30 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
extern bool use_cust_cxt;
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_ab;
|
||||
extern bool pmt_logical;
|
||||
extern bool pmt_force_mode;
|
||||
extern char *cust_cxt;
|
||||
|
||||
/* check parts */
|
||||
void check_psf()
|
||||
{
|
||||
/* true = ab | false = a */
|
||||
if (use_cust_cxt) {
|
||||
if (pmt_use_cust_cxt) {
|
||||
static char cust_cxt_ck_path[150];
|
||||
sprintf(cust_cxt_ck_path, "%s/boot_a", cust_cxt);
|
||||
if (access(cust_cxt_ck_path, F_OK) != 0) {
|
||||
@@ -52,7 +56,7 @@ void check_psf()
|
||||
}
|
||||
|
||||
/* true = logical | false = classic */
|
||||
if (use_cust_cxt) {
|
||||
if (pmt_use_cust_cxt) {
|
||||
static char cust_cxt_ckl_path[150];
|
||||
sprintf(cust_cxt_ckl_path, "%s/super", cust_cxt);
|
||||
if (access(cust_cxt_ckl_path, F_OK) != 0) {
|
||||
@@ -74,8 +78,17 @@ void check_root()
|
||||
{
|
||||
/* a quick, easy method to verify root :D */
|
||||
if (chdir("/dev/block") != 0) {
|
||||
error("Root privileges could not be detected! Please run this binary with root.\n");
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, ANSI_RED "Root privileges could not be detected! Please run this binary with root. Error reason: %s\n" ANSI_RESET, strerror(errno));
|
||||
exit(27);
|
||||
} else {
|
||||
exit(27);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#define _DOCUMENTATION_H_
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -18,6 +16,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
void licenses()
|
||||
{
|
||||
printf("Copyright 2024 YZBruh - Partition Manager\n");
|
||||
@@ -33,25 +40,28 @@ void licenses()
|
||||
|
||||
void help()
|
||||
{
|
||||
printf("Usage (arguments): \n");
|
||||
printf(" -b, --backup backup mode\n");
|
||||
printf(" -f, --flash flash mode\n");
|
||||
printf(" -p, --partition name of the partition to be backed up\n");
|
||||
printf(" -l, --logical know that the partition that will be backed up is logical\n");
|
||||
printf(" -o, --out (only backups) the output name of the backed-up partition (default: partition name)\n");
|
||||
printf(" -d, --outdir (only backups) directory where the backup partition will be saved (default: /storage/emulated/0)\n");
|
||||
printf(" -c, --context it is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name)\n");
|
||||
printf(" -D, --list list partitions\n");
|
||||
printf(" -v, --version see version\n");
|
||||
printf(" -h, --help see help message\n");
|
||||
printf(" -L, --license see license\n\n");
|
||||
printf("Example 1:\n");
|
||||
printf(" -b --partition boot_a -o boot_slot_a_image -d /sdcard/backup -c /dev/block/platform/bootdevice/by-name\n\n");
|
||||
printf("Example 2:\n");
|
||||
printf(" --flash /sdcard/twrp/boot.img -p boot_a -c /dev/block/platform/bootdevice/by-name\n\n");
|
||||
printf("Example 3:\n");
|
||||
printf("Usage: \n");
|
||||
printf(" -b | --backup backup mode\n");
|
||||
printf(" -F | --flash flash mode\n");
|
||||
printf(" -p | --partition name of the partition to be backed up\n");
|
||||
printf(" -l | --logical know that the partition that will be backed up is logical\n");
|
||||
printf(" -o | --out (only backups) the output name of the backed-up partition (default: partition name)\n");
|
||||
printf(" -d | --outdir (only backups) directory where the backup partition will be saved (default: /storage/emulated/0)\n");
|
||||
printf(" -c | --context it is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name)\n");
|
||||
printf(" -D | --list list partitions\n");
|
||||
printf(" -f | --force force mode. Output is not produced. Even if it's a mistake. But if the target is not a mode, the error is given. If you want to work stable, it is important to specify this option first.\n");
|
||||
printf(" -v | --version see version\n");
|
||||
printf(" --help see help message\n");
|
||||
printf(" -L | --license see license\n\n");
|
||||
printf("Examples:\n");
|
||||
printf(" -b --partition boot_a -o boot_slot_a_image -d /sdcard/backup -c /dev/block/platform/bootdevice/by-name\n");
|
||||
printf(" --flash /sdcard/twrp/boot.img -p boot_a -c /dev/block/platform/bootdevice/by-name\n");
|
||||
printf(" -c /dev/block/platform/bootdevice/by-name --list\n\n");
|
||||
printf("Report bugs to <xda-@YZBruh>\n");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
@@ -1,10 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/common.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -23,11 +16,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
/* shorter error messages will be functional xd */
|
||||
void error(const char *err_msg)
|
||||
void error(const char *err_msg, uint32_t errcode)
|
||||
{
|
||||
fprintf(stderr, ANSI_RED "%s" ANSI_RESET, err_msg);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(errcode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/common.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -26,8 +16,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
extern char *cust_cxt;
|
||||
extern bool use_cust_cxt;
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_force_mode;
|
||||
|
||||
/* flasher func */
|
||||
void flash(char *target_flash_partition, char *target_file, char *flash_partition_style)
|
||||
@@ -36,7 +40,7 @@ void flash(char *target_flash_partition, char *target_file, char *flash_partitio
|
||||
/* determine device block */
|
||||
/* for classic */
|
||||
if (strstr(flash_partition_style, "classic") != NULL) {
|
||||
if (use_cust_cxt) {
|
||||
if (pmt_use_cust_cxt) {
|
||||
sprintf(flasher_path, "%s/%s", cust_cxt, target_flash_partition);
|
||||
} else {
|
||||
sprintf(flasher_path, "/dev/block/by-name/%s", target_flash_partition);
|
||||
@@ -45,14 +49,20 @@ void flash(char *target_flash_partition, char *target_file, char *flash_partitio
|
||||
} else if (strstr(flash_partition_style, "logical") != NULL) {
|
||||
sprintf(flasher_path, "/dev/block/mapper/%s", target_flash_partition);
|
||||
} else {
|
||||
error("İnvalid partition type!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("İnvalid partition type!\n", 30);
|
||||
} else {
|
||||
exit(30);
|
||||
}
|
||||
}
|
||||
|
||||
/* check partition */
|
||||
if (access(flasher_path, F_OK) == -1) {
|
||||
error("Partition not found!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("Partition not found!\n", 31);
|
||||
} else {
|
||||
printf("Target partition: %s\nFlashing...\n", target_flash_partition);
|
||||
exit(31);
|
||||
}
|
||||
}
|
||||
|
||||
/* setting up */
|
||||
@@ -61,10 +71,16 @@ void flash(char *target_flash_partition, char *target_file, char *flash_partitio
|
||||
|
||||
/* start flash */
|
||||
if (system(flasher_cmd) != 0) {
|
||||
error("Failed!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("Failed!\n", 98);
|
||||
} else {
|
||||
printf("%sSuccess.%s\n", ANSI_GREEN, ANSI_RESET);
|
||||
exit(98);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#define _COMMON_H_
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -18,6 +16,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* check compiler system */
|
||||
#ifdef _WIN32
|
||||
#error "it can only be compiled in linux or android environment. but current system windows (_WIN32 defined)"
|
||||
#elif ! __linux__ || __android__
|
||||
#error "unknown compiler system founded"
|
||||
#endif
|
||||
|
||||
/* compiler architecture if arm is not 32-bit or 64-bit, the compilation is stopped */
|
||||
#if ! defined __arm__ || __aarch64__ || __aarch32__ || __armv8__ || __armv7l__
|
||||
#error "only 32-bit or 64-bit arm compilers can be used"
|
||||
#endif
|
||||
|
||||
#ifndef _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
|
||||
/* color definations */
|
||||
#define ANSI_RED "\033[31m"
|
||||
#define ANSI_YELLOW "\033[33m"
|
||||
@@ -25,10 +42,10 @@
|
||||
#define ANSI_RESET "\033[0m"
|
||||
|
||||
/* info */
|
||||
#define PACK_VER "1.5.0"
|
||||
#define PACK_VER_CODE "150"
|
||||
#define PACK_NAME "Partition Manager"
|
||||
#define PACK_LANG "en"
|
||||
#define PMT_VERSION "1.7.0"
|
||||
#define PMT_VERSION_CODE "170"
|
||||
#define PMT_PACKAGE_NAME "Partition Manager"
|
||||
#define PMT_PACKAGE_LANG "en"
|
||||
|
||||
/* variable definations */
|
||||
extern char *out;
|
||||
@@ -36,17 +53,27 @@ extern char *outdir;
|
||||
extern char *cust_cxt;
|
||||
extern char *target_partition;
|
||||
extern char *target_flash_file;
|
||||
extern bool use_logical;
|
||||
extern bool use_cust_cxt;
|
||||
extern bool pmt_use_logical;
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_ab;
|
||||
extern bool pmt_logical;
|
||||
extern bool pmt_flash;
|
||||
extern bool pmt_backup;
|
||||
extern bool pmt_force_mode;
|
||||
|
||||
/* function definations */
|
||||
void listpart();
|
||||
void error(const char *err_msg);
|
||||
void error(const char *err_msg, uint32_t errcode);
|
||||
void check_psf();
|
||||
void check_root();
|
||||
void backup(char *target_backup_partition, char *backup_partition_style);
|
||||
void flash(char *target_flash_partition, char *target_file, char *flash_partition_style);
|
||||
void help();
|
||||
void licenses();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* end of code */
|
||||
@@ -1,10 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "include/common.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -23,41 +16,76 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
extern char *cust_cxt;
|
||||
extern bool use_cust_cxt;
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_ab;
|
||||
extern bool pmt_logical;
|
||||
extern bool pmt_force_mode;
|
||||
extern char *cust_cxt;
|
||||
|
||||
/* list existing partitions */
|
||||
void listpart() {
|
||||
if (use_cust_cxt) {
|
||||
printf("List of classic partitions (%s): \n", cust_cxt);
|
||||
static char cust_cxt_path[150];
|
||||
sprintf(cust_cxt_path, "ls %s", cust_cxt);
|
||||
if (system(cust_cxt_path) != 0) {
|
||||
error("An error occurred when the partition list appears!\n");
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
||||
if (pmt_use_cust_cxt) {
|
||||
dir = opendir(cust_cxt);
|
||||
if (dir == NULL) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "Could not open: `%s`. Error reason: %s\n", cust_cxt, strerror(errno));
|
||||
exit(62);
|
||||
} else {
|
||||
exit(62);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("List of classic partitions (/dev/block/by-name): \n");
|
||||
if (system("ls /dev/block/by-name") != 0) {
|
||||
error("An error occurred when the classic partition list appears!\n");
|
||||
dir = opendir("/dev/block/by-name");
|
||||
if (dir == NULL) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "Could not open: `/dev/block/by-name`. Error reason: %s\n", strerror(errno));
|
||||
exit(63);
|
||||
} else {
|
||||
exit(63);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
printf("%s\n", entry->d_name);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
if (pmt_logical) {
|
||||
printf("List of logical partitions (/dev/block/mapper): \n");
|
||||
if (system("ls /dev/block/mapper") != 0) {
|
||||
error("An error occurred when the logical partition list appears!\n");
|
||||
if (system("ls /dev/block/mapper") != 0 && !pmt_force_mode) {
|
||||
error("An error occurred when the logical partition list appears!\n", 64);
|
||||
}
|
||||
}
|
||||
|
||||
if (pmt_ab) {
|
||||
if (pmt_ab && !pmt_force_mode) {
|
||||
printf("%sWarning: device using A/B partition style.%s\n", ANSI_YELLOW, ANSI_RESET);
|
||||
}
|
||||
|
||||
if (pmt_logical) {
|
||||
if (pmt_logical && !pmt_force_mode) {
|
||||
printf("%sWarning: device using logical partition type.%s\n", ANSI_YELLOW, ANSI_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
183
binary/pmt.c
183
binary/pmt.c
@@ -1,16 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <getopt.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/common.h"
|
||||
#include "include/documentation.h"
|
||||
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
@@ -29,39 +16,56 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "include/pmt.h"
|
||||
|
||||
char *out = NULL;
|
||||
char *outdir = NULL;
|
||||
char *cust_cxt = NULL;
|
||||
char *target_partition = NULL;
|
||||
char *target_flash_file = NULL;
|
||||
bool use_logical = NULL;
|
||||
bool use_cust_cxt = NULL;
|
||||
bool pmt_use_logical = NULL;
|
||||
bool pmt_use_cust_cxt = NULL;
|
||||
bool pmt_ab = false;
|
||||
bool pmt_logical = false;
|
||||
bool pmt_flash = false;
|
||||
bool pmt_backup = false;
|
||||
bool pmt_force_mode = false;
|
||||
|
||||
/* classic main function (C binary here xd) */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/* check argument total */
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s [-b, --backup] [-f, --flash] [-p, --partition] [-l, --logical] [-f, --flash] [-o, --out] [-d, --outdir] [-D, --list] [-v, --version] [-h, --help] [-L, --license]\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "%s: missing operand\nTry `%s --help` for more information.\n", argv[0], argv[0]);
|
||||
exit(44);
|
||||
}
|
||||
|
||||
/* a structure for long arguments... */
|
||||
struct option long_options[] = {
|
||||
{"backup", no_argument, 0, 'b'},
|
||||
{"flash", required_argument, 0, 'f'},
|
||||
{"flash", required_argument, 0, 'F'},
|
||||
{"partition", required_argument, 0, 'p'},
|
||||
{"logical", no_argument, 0, 'l'},
|
||||
{"out", required_argument, 0, 'o'},
|
||||
{"outdir", required_argument, 0, 'd'},
|
||||
{"context", required_argument, 0, 'c'},
|
||||
{"list", no_argument, 0, 'D'},
|
||||
{"force", no_argument, 0, 'f'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"help", no_argument, 0, 0},
|
||||
{"license", no_argument, 0, 'L'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
@@ -71,75 +75,115 @@ int main(int argc, char *argv[])
|
||||
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.\n";
|
||||
int opt;
|
||||
/* control for each argument */
|
||||
while ((opt = getopt_long(argc, argv, "bf:p:lo:d:c:DvhL", long_options, NULL)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "bF:p:lo:d:c:DfvL", long_options, NULL)) != -1) {
|
||||
/* process arguments */
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
pmt_backup = true;
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
target_flash_file = strdup(optarg);
|
||||
if (strncmp(target_flash_file, opt_symbol, 1) == 0) {
|
||||
error(common_symbol_rule);
|
||||
if (!pmt_force_mode) {
|
||||
error(common_symbol_rule, 19);
|
||||
} else {
|
||||
exit(19);
|
||||
}
|
||||
}
|
||||
pmt_flash = true;
|
||||
check_root();
|
||||
check_psf();
|
||||
struct stat flashf_info;
|
||||
if (stat(target_flash_file, &flashf_info) != 0) {
|
||||
fprintf(stderr, "%s: %s: no such file or directory.\n", argv[0], target_flash_file);
|
||||
exit(EXIT_FAILURE);
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], target_flash_file, strerror(errno));
|
||||
exit(15);
|
||||
} else {
|
||||
exit(15);
|
||||
}
|
||||
} else {
|
||||
if (!S_ISREG(flashf_info.st_mode)) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: is a not file.\n", argv[0], target_flash_file);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(16);
|
||||
} else {
|
||||
exit(16);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
target_partition = strdup(optarg);
|
||||
if (strncmp(target_partition, opt_symbol, 1) == 0) {
|
||||
error(common_symbol_rule);
|
||||
if (!pmt_force_mode) {
|
||||
error(common_symbol_rule, 19);
|
||||
} else {
|
||||
exit(19);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
check_root();
|
||||
check_psf();
|
||||
if (pmt_logical) {
|
||||
use_logical = true;
|
||||
pmt_use_logical = true;
|
||||
} else {
|
||||
error("This device does not have logical partitions!\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("This device does not have logical partitions!\n", 17);
|
||||
} else {
|
||||
exit(17);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
out = strdup(optarg);
|
||||
if (strncmp(out, opt_symbol, 1) == 0) {
|
||||
error(common_symbol_rule);
|
||||
if (!pmt_force_mode) {
|
||||
error(common_symbol_rule, 19);
|
||||
} else {
|
||||
exit(19);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
outdir = strdup(optarg);
|
||||
if (strncmp(outdir, opt_symbol, 1) == 0) {
|
||||
error(common_symbol_rule);
|
||||
if (!pmt_force_mode) {
|
||||
error(common_symbol_rule, 19);
|
||||
} else {
|
||||
exit(19);
|
||||
}
|
||||
}
|
||||
check_root();
|
||||
check_psf();
|
||||
struct stat out_info;
|
||||
if (stat(outdir, &out_info) != 0) {
|
||||
fprintf(stderr, "%s: %s: no such file or directory.\n", argv[0], outdir);
|
||||
exit(EXIT_FAILURE);
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], outdir, strerror(errno));
|
||||
exit(18);
|
||||
} else {
|
||||
exit(18);
|
||||
}
|
||||
} else {
|
||||
if (!S_ISDIR(out_info.st_mode)) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: is a not directory.\n", argv[0], outdir);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(20);
|
||||
} else {
|
||||
exit(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
use_cust_cxt = true;
|
||||
pmt_use_cust_cxt = true;
|
||||
cust_cxt = strdup(optarg);
|
||||
if (strncmp(cust_cxt, opt_symbol, 1) == 0) {
|
||||
error(common_symbol_rule);
|
||||
if (!pmt_force_mode) {
|
||||
error(common_symbol_rule, 19);
|
||||
} else {
|
||||
exit(19);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
@@ -147,20 +191,23 @@ int main(int argc, char *argv[])
|
||||
listpart();
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'f':
|
||||
pmt_force_mode = true;
|
||||
break;
|
||||
case 'v':
|
||||
printf("Version: %s (code %s)\n", PACK_VER, PACK_VER_CODE);
|
||||
# ifdef __clang__
|
||||
printf("Version: %s (code %s)\n", PMT_VERSION, PMT_VERSION_CODE);
|
||||
#ifdef __clang__
|
||||
printf("Compiler: clang %s", __clang_version__);
|
||||
# endif
|
||||
# ifdef __GNUC__
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
printf("(GNUC %d.%d.%d)\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# else
|
||||
#else
|
||||
printf("\n");
|
||||
# endif
|
||||
#endif
|
||||
printf("See licenses with -L argument.\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'h':
|
||||
case 0:
|
||||
help();
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
@@ -170,21 +217,26 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
case '?':
|
||||
printf("Try `%s --help' for more information.\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(43);
|
||||
break;
|
||||
default:
|
||||
printf("Usage: %s [-b, --backup] [-f, --flash] [-p, --partition] [-l, --logical] [-f, --flash] [-o, --out] [-d, --outdir] [-D, --list] [-v, --version] [-h, --help] [-L, --license]\n", argv[0]);
|
||||
printf("Usage: %s [-b | --backup] [-f | --flash FILE] [-p | --partition PARTITION] [-l | --logical] [-o | --out OUTNAME] [-d | --outdir OUTDIR] [-c | --context] [-D | --list] [-v | --version] [--help] [-L | --license]\n", argv[0]);
|
||||
exit(44);
|
||||
}
|
||||
}
|
||||
|
||||
/* minor checks */
|
||||
if (!pmt_backup && !pmt_flash) {
|
||||
fprintf(stderr, "%s: no target (backup or flash).\nTry `%s --help` for more information.\n", argv[0], argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
fprintf(stderr, "%s: missing operand.\nTry `%s --help` for more information.\n", argv[0], argv[0]);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if (pmt_backup && pmt_flash) {
|
||||
error("Backup and flash functions cannot be used in the same command\n");
|
||||
if (!pmt_force_mode) {
|
||||
error("Backup and flash functions cannot be used in the same command\n", 9);
|
||||
} else {
|
||||
exit(9);
|
||||
}
|
||||
}
|
||||
|
||||
/* checks */
|
||||
@@ -192,29 +244,40 @@ int main(int argc, char *argv[])
|
||||
check_psf();
|
||||
|
||||
/* custom context checker */
|
||||
if (use_cust_cxt) {
|
||||
if (pmt_use_cust_cxt) {
|
||||
struct stat cxtinfo;
|
||||
if (stat(cust_cxt, &cxtinfo) == 0) {
|
||||
if (S_ISDIR(cxtinfo.st_mode)) {
|
||||
/* empty */
|
||||
if (!S_ISREG(cxtinfo.st_mode)) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: is a not directory.\n", argv[0], cust_cxt);
|
||||
exit(8);
|
||||
} else {
|
||||
fprintf(stderr, "%s: custom context: %s: is a not directory.\n", argv[0], cust_cxt);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(8);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error("The specified context was not found!\n");
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], cust_cxt, strerror(errno));
|
||||
exit(6);
|
||||
} else {
|
||||
exit(6);
|
||||
}
|
||||
if (strstr(cust_cxt, "/dev") == NULL) {
|
||||
}
|
||||
if (strstr(cust_cxt, "/dev") == NULL && !pmt_force_mode) {
|
||||
printf("%sThis custom context is strange...%s\n", ANSI_YELLOW, ANSI_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
if (target_partition == NULL) {
|
||||
if (!pmt_force_mode) {
|
||||
fprintf(stderr, "%s: required partition name.\nTry `%s --help' for more information.\n", argv[0], argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(5);
|
||||
} else {
|
||||
exit(5);
|
||||
}
|
||||
} else {
|
||||
if (pmt_backup) {
|
||||
if (use_logical) {
|
||||
if (pmt_use_logical) {
|
||||
backup(target_partition, "logical");
|
||||
exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
@@ -222,7 +285,7 @@ int main(int argc, char *argv[])
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
} else if (pmt_flash) {
|
||||
if (use_logical) {
|
||||
if (pmt_use_logical) {
|
||||
flash(target_partition, target_flash_file, "logical");
|
||||
exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
@@ -231,9 +294,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s: no target (backup or flash).\nTry `%s --help` for more information.\n", argv[0], argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
|
||||
61
config/env.mk
Normal file
61
config/env.mk
Normal file
@@ -0,0 +1,61 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 YZBruh - 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.
|
||||
|
||||
#########################################
|
||||
# #
|
||||
# Configuration Flags #
|
||||
# #
|
||||
# Warning: you can edit #
|
||||
# #
|
||||
#########################################
|
||||
|
||||
|
||||
# use custom gcc | true or false
|
||||
USE_CUST_GCC := false
|
||||
|
||||
# custom gcc ext (if used)
|
||||
CUST_GCC :=
|
||||
|
||||
# addionital gcc flags
|
||||
EXTRA_GCC_FLAGS :=
|
||||
|
||||
#########################################
|
||||
#########################################
|
||||
|
||||
#########################################
|
||||
# #
|
||||
# Apply Configuration #
|
||||
# #
|
||||
# Warning: please do not edit #
|
||||
# #
|
||||
#########################################
|
||||
|
||||
# gcc setting
|
||||
ifeq ($(USE_CUST_GCC), true)
|
||||
CC := $(CUST_GCC)
|
||||
LD := $(CUST_GCC)
|
||||
else ifeq ($(USE_CUST_GCC), false)
|
||||
CC := gcc
|
||||
LD := gcc
|
||||
else
|
||||
$(error İnvalid custom gcc config flag: $(USE_CUST_GCC))
|
||||
endif
|
||||
|
||||
# gcc flag settings
|
||||
CFLAGS := -O3 -g -Wall -Wextra $(EXTRA_GCC_FLAGS)
|
||||
|
||||
#########################################
|
||||
#########################################
|
||||
@@ -1,31 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 YZBruh - 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.
|
||||
|
||||
# gcc setting
|
||||
ifeq ($(USE_CUST_GCC), true)
|
||||
CC := $(CUST_GCC)
|
||||
LD := $(CUST_GCC)
|
||||
else ifeq ($(USE_CUST_GCC), false)
|
||||
CC := gcc
|
||||
LD := gcc
|
||||
else
|
||||
$(error İnvalid custom gcc config flag: $(USE_CUST_GCC))
|
||||
endif
|
||||
|
||||
# gcc flag settings
|
||||
CFLAGS := -O3 -g -Wno-unused-parameter -Wall -Wextra -static $(EXTRA_GCC_FLAGS)
|
||||
|
||||
# end of code
|
||||
@@ -1,29 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 YZBruh - 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.
|
||||
|
||||
# use custom gcc | true or false
|
||||
USE_CUST_GCC := false
|
||||
|
||||
# custom gcc ext (if used)
|
||||
CUST_GCC :=
|
||||
|
||||
# addionital gcc flags
|
||||
EXTRA_GCC_FLAGS :=
|
||||
|
||||
# apply configration
|
||||
include mka/apply-config.mk
|
||||
|
||||
# end of config
|
||||
Reference in New Issue
Block a user