mkbootimg: replace Python version with osm0sis' C version (#1193)
Closes #441. Adjust bootimg_analyze code: * Install mkbootimg (which now provides unpackbootimg) instead of unpackbootimg. In theory, pmbootstrap should recognize this automatically, however right now it does not yet handle this case. * The file names of the extracted files have changed.
This commit is contained in:
parent
c038566fef
commit
42018f8014
|
@ -1,21 +1,24 @@
|
||||||
pkgname=mkbootimg
|
pkgname=mkbootimg
|
||||||
pkgver=14.1
|
pkgver=2017.12.13
|
||||||
pkgrel=1
|
pkgrel=0
|
||||||
pkgdesc="Android bootimg (zimage + initramfs) creation tool"
|
pkgdesc="Android bootimg creation tool"
|
||||||
url="https://github.com/LineageOS/android_system_core/blob/cm-14.1/mkbootimg/mkbootimg"
|
url="https://github.com/osm0sis/mkbootimg"
|
||||||
arch="noarch"
|
arch="all"
|
||||||
license="APACHE2"
|
license="APACHE2"
|
||||||
depends="python3"
|
depends=""
|
||||||
|
provides="unpackbootimg"
|
||||||
subpackages=""
|
subpackages=""
|
||||||
source="$pkgname::https://raw.githubusercontent.com/LineageOS/android_system_core/cm-14.1/mkbootimg/mkbootimg"
|
source="$pkgname.tar.gz::https://github.com/osm0sis/$pkgname/archive/$pkgver.tar.gz"
|
||||||
options="!check"
|
options="!check"
|
||||||
|
workdir="$pkgname-$pkgver"
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
sed -i -e 's./usr/bin/env python./usr/bin/env python3.' $srcdir/$pkgname
|
make -j1
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm755 $srcdir/$pkgname $pkgdir/usr/bin/$pkgname
|
install -Dm755 "$srcdir/$workdir/mkbootimg" "${pkgdir}/usr/bin/mkbootimg"
|
||||||
|
install -Dm755 "$srcdir/$workdir/unpackbootimg" "${pkgdir}/usr/bin/unpackbootimg"
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="71ab9b6dfe19096bf6b33a8c46148dbe2b8b71fd693dcaf8cdba7a932e19bb7d29c3c245148a4b27119a6b883fc8f0ba04f5f815da0c40410b2b11d9fa1b7cd7 mkbootimg"
|
sha512sums="39820ee581f007b6e7c69f83ae6d54e99d32869604d1a960421c0c588fa55917f686104782b1e5ff5cb586f7efb19e9b9db11e69031cbb5e22462ab9d39cdc20 mkbootimg.tar.gz"
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
pkgname=unpackbootimg
|
|
||||||
pkgver="14.1"
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Android bootimg (zimage + initramfs) extraction tool"
|
|
||||||
url="https://github.com/LineageOS/android_system_core"
|
|
||||||
arch="noarch"
|
|
||||||
license="APACHE2"
|
|
||||||
depends="python3"
|
|
||||||
source="$pkgname-$pkgver.py::https://raw.githubusercontent.com/LineageOS/android_system_core/cm-${pkgver}/mkbootimg/${pkgname}"
|
|
||||||
options="!check"
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cp "$srcdir"/"$pkgname"-"$pkgver".py "$srcdir"/"$pkgname"
|
|
||||||
sed -i -e 's./usr/bin/env python./usr/bin/env python3.' "$srcdir"/"$pkgname"
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
install -Dm755 "$srcdir"/"$pkgname" "$pkgdir"/usr/bin/"$pkgname"
|
|
||||||
}
|
|
||||||
|
|
||||||
sha512sums="b86022b3f16a6a35c68a7dd00b0ce2dcac667162f11581090bdb07d50a3ea93a74c2f493405d3d6751d40bf463c022216738ad8bcafc457dfc55e08aa5c2ed0e unpackbootimg-14.1.py"
|
|
|
@ -27,7 +27,7 @@ def bootimg(args, path):
|
||||||
|
|
||||||
logging.info("NOTE: You will be prompted for your sudo password, so we can set"
|
logging.info("NOTE: You will be prompted for your sudo password, so we can set"
|
||||||
" up a chroot to extract and analyze your boot.img file")
|
" up a chroot to extract and analyze your boot.img file")
|
||||||
pmb.chroot.apk.install(args, ["file", "unpackbootimg"])
|
pmb.chroot.apk.install(args, ["file", "mkbootimg"])
|
||||||
|
|
||||||
temp_path = pmb.chroot.other.tempfolder(args, "/tmp/bootimg_parser")
|
temp_path = pmb.chroot.other.tempfolder(args, "/tmp/bootimg_parser")
|
||||||
bootimg_path = args.work + "/chroot_native" + temp_path + "/boot.img"
|
bootimg_path = args.work + "/chroot_native" + temp_path + "/boot.img"
|
||||||
|
@ -52,20 +52,20 @@ def bootimg(args, path):
|
||||||
# Get base, offsets, pagesize, cmdline and qcdt info
|
# Get base, offsets, pagesize, cmdline and qcdt info
|
||||||
with open(bootimg_path + "-base", 'r') as f:
|
with open(bootimg_path + "-base", 'r') as f:
|
||||||
output["base"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
output["base"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
||||||
with open(bootimg_path + "-kernel_offset", 'r') as f:
|
with open(bootimg_path + "-kerneloff", 'r') as f:
|
||||||
output["kernel_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
output["kernel_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
||||||
with open(bootimg_path + "-ramdisk_offset", 'r') as f:
|
with open(bootimg_path + "-ramdiskoff", 'r') as f:
|
||||||
output["ramdisk_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
output["ramdisk_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
||||||
with open(bootimg_path + "-second_offset", 'r') as f:
|
with open(bootimg_path + "-secondoff", 'r') as f:
|
||||||
output["second_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
output["second_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
||||||
with open(bootimg_path + "-tags_offset", 'r') as f:
|
with open(bootimg_path + "-tagsoff", 'r') as f:
|
||||||
output["tags_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
output["tags_offset"] = ("0x%08x" % int(f.read().replace('\n', ''), 16))
|
||||||
with open(bootimg_path + "-pagesize", 'r') as f:
|
with open(bootimg_path + "-pagesize", 'r') as f:
|
||||||
output["pagesize"] = f.read().replace('\n', '')
|
output["pagesize"] = f.read().replace('\n', '')
|
||||||
with open(bootimg_path + "-cmdline", 'r') as f:
|
with open(bootimg_path + "-cmdline", 'r') as f:
|
||||||
output["cmdline"] = f.read().replace('\n', '')
|
output["cmdline"] = f.read().replace('\n', '')
|
||||||
output["qcdt"] = ("true" if os.path.isfile(bootimg_path + "-dt") and
|
output["qcdt"] = ("true" if os.path.isfile(bootimg_path + "-dtb") and
|
||||||
os.path.getsize(bootimg_path + "-dt") > 0 else "false")
|
os.path.getsize(bootimg_path + "-dtb") > 0 else "false")
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
pmb.chroot.root(args, ["rm", "-r", temp_path])
|
pmb.chroot.root(args, ["rm", "-r", temp_path])
|
||||||
|
|
Loading…
Reference in New Issue