Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit de29903
Showing
47 changed files
with
3,244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.pro.user | ||
*.img | ||
bin/mkbootimg | ||
bin/sntool | ||
bin/sunxi-fel | ||
bin/unpackbootimg | ||
build*/ | ||
kernel*/ | ||
data/ | ||
dump/ | ||
mod/bin/busybox | ||
mod/hakchi/transfer/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "3rdparty/mkbootimg"] | ||
path = 3rdparty/mkbootimg | ||
url = git@github.com:osm0sis/mkbootimg.git | ||
[submodule "3rdparty/sunxi-tools"] | ||
path = 3rdparty/sunxi-tools | ||
url = git@github.com:linux-sunxi/sunxi-tools.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://busybox.net/downloads/binaries/latest/busybox-armv7l |
Submodule sunxi-tools
added at
1e219c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/fel_lib.c b/fel_lib.c | ||
index a484b4c..8d4d651 100644 | ||
--- a/fel_lib.c | ||
+++ b/fel_lib.c | ||
@@ -42,8 +42,14 @@ struct _felusb_handle { | ||
bool iface_detached; | ||
}; | ||
|
||
+void no_exit(int ec) | ||
+{ | ||
+ (void)ec; | ||
+} | ||
+#define exit(x) {no_exit(x);return 0;} | ||
+ | ||
/* a helper function to report libusb errors */ | ||
-void usb_error(int rc, const char *caption, int exitcode) | ||
+void no_usb_error(int rc, const char *caption, int exitcode) | ||
{ | ||
if (caption) | ||
fprintf(stderr, "%s ", caption); | ||
@@ -58,6 +64,7 @@ void usb_error(int rc, const char *caption, int exitcode) | ||
if (exitcode != 0) | ||
exit(exitcode); | ||
} | ||
+#define usb_error(x,y,z) {no_usb_error(x,y,z);if(z!=0)return 0;} | ||
|
||
/* | ||
* AW_USB_MAX_BULK_SEND and the timeout constant USB_TIMEOUT are related. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
all: bin/sunxi-fel bin/mkbootimg bin/unpackbootimg mod/bin/busybox build/hakchi-gui bin/sntool | ||
|
||
bin/sunxi-fel: 3rdparty/sunxi-tools/sunxi-fel | ||
@cp 3rdparty/sunxi-tools/sunxi-fel bin/ | ||
|
||
3rdparty/sunxi-tools/sunxi-fel: 3rdparty/sunxi-tools/fel.c | ||
@make -C 3rdparty/sunxi-tools sunxi-fel | ||
|
||
bin/mkbootimg: 3rdparty/mkbootimg/mkbootimg | ||
@cp 3rdparty/mkbootimg/mkbootimg bin/ | ||
|
||
3rdparty/mkbootimg/mkbootimg: 3rdparty/mkbootimg/mkbootimg.c | ||
@make -C 3rdparty/mkbootimg | ||
|
||
bin/unpackbootimg: 3rdparty/mkbootimg/unpackbootimg | ||
@cp 3rdparty/mkbootimg/unpackbootimg bin/ | ||
|
||
3rdparty/mkbootimg/unpackbootimg: 3rdparty/mkbootimg/unpackbootimg.c | ||
@make -C 3rdparty/mkbootimg | ||
|
||
mod/bin/busybox: 3rdparty/busybox.url | ||
wget --no-use-server-timestamps $(shell cat $<) -O $@ && chmod +x $@ && upx -qq --best $@ | ||
|
||
build/hakchi-gui: build/Makefile hakchi-gui/src/* | ||
@make -C build | ||
|
||
build/Makefile: hakchi-gui/hakchi-gui.pro | ||
@mkdir -p build && (cd build; qmake ../$< CONFIG+=release) | ||
|
||
bin/sntool: sntool/sntool.cpp | ||
@g++ -std=gnu++11 -Wall -Wextra $< -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
img=$1 | ||
if [ -z "$img" ]; then | ||
img=./dump/kernel.img | ||
fi | ||
|
||
infile=$(basename "$img") | ||
inpath=./$(basename "$infile" .img) | ||
|
||
rm -rf "$inpath" | ||
mkdir "$inpath" | ||
unpackbootimg -i "$img" -o "$inpath" | ||
lzop -d "$inpath/$infile-ramdisk.gz" -o "$inpath/initramfs.cpio" | ||
mkdir "$inpath/initramfs" | ||
(cd "$inpath/initramfs";cpio -imd --no-preserve-owner --quiet -I "../initramfs.cpio") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@echo off | ||
|
||
set img=%~f1 | ||
if "%img%"=="" goto error | ||
|
||
set infile=%~nx1 | ||
set inpath=.\%~n1 | ||
|
||
if exist "%inpath%" rd /s /q "%inpath%" | ||
if %errorlevel% neq 0 goto error | ||
|
||
md "%inpath%" | ||
if %errorlevel% neq 0 goto error | ||
|
||
unpackbootimg -i "%img%" -o "%inpath%" | ||
if %errorlevel% neq 0 goto error | ||
|
||
lzop -d "%inpath%\%infile%-ramdisk.gz" -o "%inpath%\initramfs.cpio" | ||
if %errorlevel% neq 0 goto error | ||
|
||
md "%inpath%\initramfs" | ||
if %errorlevel% neq 0 goto error | ||
|
||
cd "%inpath%\initramfs" | ||
if %errorlevel% neq 0 goto error | ||
|
||
cpio -imd --no-preserve-owner --quiet -I "..\initramfs.cpio" | ||
if %errorlevel% neq 0 goto error | ||
|
||
exit /b %errorlevel% | ||
|
||
:error | ||
if %errorlevel% equ 0 set errorlevel=7 | ||
echo %0 %1 -^> exit %errorlevel% ?!? | ||
exit /b %errorlevel% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
sunxi-fel version | ||
|
||
sunxi-fel write 0x2000 data/fes1.bin | ||
sunxi-fel exe 0x2000 | ||
|
||
sunxi-fel -p write 0x43800000 kernel.img | ||
sunxi-fel -p write 0x47000000 data/uboot.bin | ||
sunxi-fel exe 0x47000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
inpath=$1 | ||
if [ -z "$inpath" ]; then | ||
inpath=./kernel | ||
fi | ||
|
||
infile=$(basename "$inpath").img | ||
img=./$infile | ||
|
||
rm -rf "$inpath/initramfs/hakchi/transfer" | ||
(cd "$inpath/../mod";cp -a * "../$inpath/initramfs/") | ||
if [ "$2" == "notx" ]; then | ||
rm -rf "$inpath/initramfs/hakchi/transfer" | ||
fi | ||
upx -qq --best "$inpath/initramfs/sbin/cryptsetup" || true | ||
(cd "$inpath/initramfs";find . -print0 | sort -z | cpio -0o -H newc -R root:root --quiet > ../initramfs.cpio) | ||
lzop --best -f -o "$inpath/$infile-ramdisk.gz" "$inpath/initramfs.cpio" | ||
|
||
mkbootimg \ | ||
--kernel "$inpath/$infile-zImage" \ | ||
--ramdisk "$inpath/$infile-ramdisk.gz" \ | ||
--cmdline "$(cat $inpath/$infile-cmdline)" \ | ||
--board "$(cat $inpath/$infile-board)" \ | ||
--base "$(cat $inpath/$infile-base)" \ | ||
--pagesize "$(cat $inpath/$infile-pagesize)" \ | ||
--kernel_offset "$(cat $inpath/$infile-kerneloff)" \ | ||
--ramdisk_offset "$(cat $inpath/$infile-ramdiskoff)" \ | ||
--tags_offset "$(cat $inpath/$infile-tagsoff)" \ | ||
-o "$img" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@echo off | ||
|
||
set inpath=%~f1 | ||
if "%inpath%"=="" goto error | ||
|
||
set infile=%~nx1.img | ||
set img=.\%~nx1.img | ||
|
||
if exist "%inpath%\initramfs\hakchi\transfer" rd /s /q "%inpath%\initramfs\hakchi\transfer" | ||
xcopy "%inpath%\..\mod" "%inpath%\initramfs" /h /y /c /r /s /q || cd >nul | ||
if "%2"=="notx" if exist "%inpath%\initramfs\hakchi\transfer" rd /s /q "%inpath%\initramfs\hakchi\transfer" | ||
if %errorlevel% neq 0 goto error | ||
|
||
upx -qq --best "%inpath%\initramfs\sbin\cryptsetup" || cd >nul | ||
|
||
mkbootfs "%inpath%\initramfs" > "%inpath%\initramfs.cpio" | ||
if %errorlevel% neq 0 goto error | ||
|
||
lzop --best -f -o "%inpath%\%infile%-ramdisk.gz" "%inpath%\initramfs.cpio" | ||
if %errorlevel% neq 0 goto error | ||
|
||
set /p cmdline=<"%inpath%\%infile%-cmdline" | ||
set /p board=<"%inpath%\%infile%-board" | ||
set /p base=<"%inpath%\%infile%-base" | ||
set /p pagesize=<"%inpath%\%infile%-pagesize" | ||
set /p kerneloff=<"%inpath%\%infile%-kerneloff" | ||
set /p ramdiskoff=<"%inpath%\%infile%-ramdiskoff" | ||
set /p tagsoff=<"%inpath%\%infile%-tagsoff" | ||
|
||
mkbootimg --kernel "%inpath%\%infile%-zImage" --ramdisk "%inpath%\%infile%-ramdisk.gz" --cmdline "%cmdline%" --board "%board%" --base "%base%" --pagesize "%pagesize%" --kernel_offset "%kerneloff%" --ramdisk_offset "%ramdiskoff%" --tags_offset "%tagsoff%" -o "%img%" | ||
if %errorlevel% neq 0 goto error | ||
|
||
exit /b %errorlevel% | ||
|
||
:error | ||
if %errorlevel% equ 0 set errorlevel=7 | ||
echo %0 %1 %2 -^> exit %errorlevel% ?!? | ||
exit /b %errorlevel% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
QT+=core gui | ||
greaterThan(QT_MAJOR_VERSION,4):QT+=widgets | ||
TARGET=hakchi-gui | ||
TEMPLATE=app | ||
|
||
INCLUDEPATH+=$${PWD}/../3rdparty/sunxi-tools $${PWD}/../3rdparty/sunxi-tools/include $${PWD}/../3rdparty/mkbootimg | ||
DEPENDPATH+=$${PWD}/src $${PWD}/../3rdparty/sunxi-tools $${PWD}/../3rdparty/sunxi-tools/include | ||
LIBS += $$system(pkg-config --libs \"libusb-1.0 >= 1.0.0\" --static) | ||
QMAKE_CFLAGS += $$system(pkg-config --cflags \"libusb-1.0 >= 1.0.0\") -std=gnu99 -DNDEBUG -Wall -Wextra | ||
QMAKE_CXXFLAGS += $$system(pkg-config --cflags \"libusb-1.0 >= 1.0.0\") -Wall -Wextra | ||
|
||
SOURCES += fel_lib.c soc_info.c progress.c | ||
|
||
SOURCES += $${PWD}/src/*.cpp | ||
SOURCES += $${PWD}/src/*.c | ||
HEADERS += $${PWD}/src/*.h | ||
FORMS += $${PWD}/src/*.ui |
Oops, something went wrong.