mirror of
https://github.com/xiaolu/mkbootimg_tools.git
synced 2026-02-13 21:49:29 +01:00
Update file and magic.mgc
file is statically compiled and bumped to version 5.24 Updated mkboot script to use file and magic.mgc for handling lzop compression types and removed previous workaround. TODO - still need to compile lzop statically and include binary with project Busybox lzop is still being used so if your busybox does not support lzop then it will not work
This commit is contained in:
BIN
ARM/magic.mgc
Normal file
BIN
ARM/magic.mgc
Normal file
Binary file not shown.
42
ARM/mkboot
42
ARM/mkboot
@@ -32,7 +32,7 @@ lzma=$tooldir/lzma
|
||||
xz=$tooldir/xz # Also used for lzma compression
|
||||
grep=$tooldir/grep
|
||||
cpio=$tooldir/cpio
|
||||
magic=$tooldir/magic
|
||||
magic=$tooldir/magic.mgc
|
||||
file=$tooldir/file
|
||||
old_bootimg=true
|
||||
C_OUT="\033[0;1m"
|
||||
@@ -133,17 +133,17 @@ mkboot_img() {
|
||||
pout "\nKernel size: $kernel_size, new ramdisk size: $ramdisk_size, $($busybox basename $new_img): $boot_size."
|
||||
pout "\n$($busybox basename $new_img) has been created.\n"
|
||||
|
||||
# Check if new build is larger than original
|
||||
# Give caution if it is to insure size is not larger than the partition
|
||||
# A courtesy warning
|
||||
if [[ "$image_size" -lt "$boot_size" ]]; then
|
||||
beefed_up=$(( $boot_size - $image_size ))
|
||||
pcaut "\n****** CAUTION ******* CAUTION ******* CAUTION ******"
|
||||
pout "\n$($busybox basename $new_img) is $beefed_up bytes larger than"
|
||||
pout "the original build! Make sure this new"
|
||||
pout "size is not larger than the actual partition!"
|
||||
pcaut "\n****** CAUTION ******* CAUTION ******* CAUTION ******\n"
|
||||
fi
|
||||
# Check if new build is larger than original
|
||||
# Give caution if it is to insure size is not larger than the partition
|
||||
# A courtesy warning
|
||||
if [[ "$image_size" -lt "$boot_size" ]]; then
|
||||
beefed_up=$(( $boot_size - $image_size ))
|
||||
pcaut "\n****** CAUTION ******* CAUTION ******* CAUTION ******"
|
||||
pout "\n$($busybox basename $new_img) is $beefed_up bytes larger than"
|
||||
pout "the original build! Make sure this new"
|
||||
pout "size is not larger than the actual partition!"
|
||||
pcaut "\n****** CAUTION ******* CAUTION ******* CAUTION ******\n"
|
||||
fi
|
||||
}
|
||||
|
||||
#decide action
|
||||
@@ -175,15 +175,8 @@ if [ ! -z $mkboot_from_dir ]; then
|
||||
[ -z $second_size ] && second_size=0
|
||||
[ -z $dtb_size ] && dtb_size=0
|
||||
|
||||
# Temporary solution for lzop compression
|
||||
# Check for lzop magic (\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a) before anything else
|
||||
# TODO: Fix file and magic to properly read lzop
|
||||
if [ -d $ramdisk ]; then
|
||||
if $grep $'\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a' ./ramdisk.* > /dev/null; then
|
||||
compression_type=lzop
|
||||
else
|
||||
compression_type=$($file -m $magic ./ramdisk.* | $busybox cut -d: -f2 | $busybox cut -d" " -f2)
|
||||
fi
|
||||
compression_type=$($file -m $magic ./ramdisk.* | $busybox cut -d: -f2 | $busybox cut -d" " -f2)
|
||||
compression_ext=$compression_type
|
||||
case $compression_type in
|
||||
gzip) compression_warning=$compression_type; compression_repack=$gzip;;
|
||||
@@ -404,14 +397,7 @@ $busybox printf "image_size=$image_size" >> img_info
|
||||
$busybox mkdir ramdisk
|
||||
cd ramdisk
|
||||
|
||||
# Temporary solution for lzop compression
|
||||
# Check for lzop magic (\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a) before anything else
|
||||
# TODO: Fix file and magic to properly read lzop
|
||||
if $grep $'\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a' ../ramdisk.gz > /dev/null; then
|
||||
compression_type=lzop
|
||||
else
|
||||
compression_type=$($file -m $magic ../ramdisk.gz | $busybox cut -d: -f2 | $busybox cut -d" " -f2)
|
||||
fi;
|
||||
compression_type=$($file -m $magic ../ramdisk.gz | $busybox cut -d: -f2 | $busybox cut -d" " -f2)
|
||||
compression_warning=$compression_type
|
||||
|
||||
case $compression_type in
|
||||
|
||||
Reference in New Issue
Block a user