From patchwork Wed Apr 29 21:38:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 466316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3A81F14008D for ; Thu, 30 Apr 2015 07:40:04 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 087C028B436; Wed, 29 Apr 2015 23:38:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id D42702802A6 for ; Wed, 29 Apr 2015 23:37:37 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_FROM_MX=-3.1; rate: -7.6 Received: from chaos.universe-factory.net (chaos.universe-factory.net [37.72.148.22]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 29 Apr 2015 23:37:33 +0200 (CEST) Received: from avalon.neoraider.dn42 (unknown [82.139.197.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id D02641880CA for ; Wed, 29 Apr 2015 23:38:34 +0200 (CEST) From: Matthias Schiffer To: openwrt-devel@lists.openwrt.org Date: Wed, 29 Apr 2015 23:38:27 +0200 Message-Id: X-Mailer: git-send-email 2.3.7 Subject: [OpenWrt-Devel] [PATCH 1/2] ar71xx: add Image/BuildLoaderPatched macro X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" In contrast to Image/BuildLoader, Image/BuildLoaderPatched first patches the kernel command line in the image and then builds the loader without command line. This allows building loaders for systems which don't boot correctly when the kernel command line is provided by the loader (like the TP-LINK CPE series). Signed-off-by: Matthias Schiffer --- target/linux/ar71xx/image/Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index e4f6c71..06e2c0d 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -428,6 +428,28 @@ define Image/BuildLoader endef # +# Embed patched lzma-compressed kernel inside lzma-loader. +# +# Specifying the command line via the lzma-loader doesn't work with some +# models (like the TP-LINK CPE series), so this version first patches the +# command line in the image and then builds the loader around it. +# +# $(1), suffix of output filename, e.g. generic, lowercase board name, etc. +# $(2), suffix of target file to build, e.g. bin, gz, elf +# $(3), kernel command line to pass from lzma-loader to kernel +# $(4), unused here +# $(5), suffix of kernel filename, e.g. -initramfs, or empty +define Image/BuildLoaderPatched + $(call PatchKernelLzma,$(1),$(3)) + -rm -rf $(KDIR)/lzma-loader + $(LOADER_MAKE) LOADER=loader-$(1).$(2) \ + LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \ + LOADER_DATA="$(KDIR_TMP)/vmlinux-$(1)$(5).bin.lzma" BOARD="$(1)" \ + compile loader.$(2) + -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2) +endef + +# # Build lzma-loader alone which will search for lzma-compressed kernel identified by # uImage header with magic "OKLI" at boot time. #