From 41eae48e0d0fdfd1e42ffa379fcb661e6c8be79d Mon Sep 17 00:00:00 2001 From: Gokul Sriram Palanisamy Date: Wed, 9 Jan 2019 10:27:00 +0530 Subject: [PATCH] pack.py: Updated to support lkboot single image LK bootloader needs kernel image with a different image header format. Hence, we need to pack the single image with a custom kernel image. Change-Id: I326fa92a72beace40f92753eac13b638705aeb14 Signed-off-by: Gokul Sriram Palanisamy --- tools/pack.py | 10 ++++++++++ tools/pack_legacy.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/tools/pack.py b/tools/pack.py index 6b8043ac23..5913c077de 100644 --- a/tools/pack.py +++ b/tools/pack.py @@ -933,6 +933,11 @@ class Pack(object): try: if image_type == "all" or section.attrib['image_type'] == image_type: filename = section.attrib['filename_' + MODE] + if lk == "true" and "uImage" in filename: + if MODE == "32": + filename = 'openwrt-' + ARCH_NAME + '-kernelboot.img' + if MODE == "64": + filename = 'openwrt-' + ARCH_NAME + '_' + MODE + '-kernelboot.img' partition = section.attrib['label'] if filename == "": continue @@ -1203,6 +1208,11 @@ class Pack(object): try: if image_type == "all" or section.attrib['image_type'] == image_type: filename = section.attrib['filename_' + MODE] + if lk == "true" and "uImage" in filename: + if MODE == "32": + filename = 'openwrt-' + ARCH_NAME + '-kernelboot.img' + if MODE == "64": + filename = 'openwrt-' + ARCH_NAME + '_' + MODE + '-kernelboot.img' partition = section.attrib['label'] if filename == "": continue diff --git a/tools/pack_legacy.py b/tools/pack_legacy.py index 0c2be94be0..05bede10a9 100755 --- a/tools/pack_legacy.py +++ b/tools/pack_legacy.py @@ -724,6 +724,11 @@ class Pack(object): filename = "openwrt-ipq40xx-lkboot-stripped.elf" elif "ipq806x" in filename: filename = "openwrt-ipq806x-lkboot.mbn" + if lk == True and "uImage" in filename and self.flinfo.type == 'emmc': + if "ipq40xx" in filename: + filename = "openwrt-ipq40xx-kernelboot.img" + elif "ipq806x" in filename: + filename = "openwrt-ipq806x-kernelboot.img" partition = info.get(section, "partition") include = info.get(section, "include") except ConfigParserError, e: @@ -852,6 +857,11 @@ class Pack(object): filename = "openwrt-ipq40xx-lkboot-stripped.elf" elif "ipq806x" in filename: filename = "openwrt-ipq806x-lkboot.mbn" + if lk == True and "uImage" in filename: + if "ipq40xx" in filename: + filename = "openwrt-ipq40xx-kernelboot.img" + elif "ipq806x" in filename: + filename = "openwrt-ipq806x-kernelboot.img" img_size = self.__get_img_size(filename) size = roundup(img_size, flinfo.blocksize) if ( size != img_size ):