From patchwork Sat Oct 8 22:13:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 679975 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ss1152Wdqz9ryv for ; Sun, 9 Oct 2016 09:15:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=wBiMF6ka; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3ss1151SdczDrbr for ; Sun, 9 Oct 2016 09:15:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=wBiMF6ka; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3ss0zS1m1rzDrPG for ; Sun, 9 Oct 2016 09:14:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=wBiMF6ka; dkim-atps=neutral Received: by mail-wm0-x241.google.com with SMTP id 123so8280982wmb.3 for ; Sat, 08 Oct 2016 15:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=8o4h2a4hfOBeG/VbcdCl4bTylEg4IdWngicUFPD95nM=; b=wBiMF6kaS6/xNAYPCz/8C2XpsW5eikJ5J3SW5l/NCZfIgvQNx83DpR7YSAw7nHqRaS ksOE6H3Mp4Dlu7gUkzlp5nM0uFU/AOjXrkKPCIyJymfSC6dQTYz+BTvLU2BW8pUwWR/W ogF20nHvRlbFw/uKEOd5U6OIrc7N8f5/srauyqsG8mH0RKx1n4mQJC3JIP5A2w+2cUNa h1Re7ADUGw6OjWAB/N0ufTkZpI3A6G5/RndFx22XjHsnhR7vOrSnFg6559LEZUSVj5Ag E1bB29/JsDlW+wSYdkyZjsV8W9Sh1414FvgCfs7Wq3wcuBbHTelWJF8v7ISl/cdJKf3b gC0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=8o4h2a4hfOBeG/VbcdCl4bTylEg4IdWngicUFPD95nM=; b=BDUIMYa08GQ9XovGo4R0tanedVob94aC9MWpIdSWCuyMZVnYGluAnKUteBjf5HRHmO ub2ppc/1/i763kYh04ZSGNAl1w8IkZLiu1gWUj88Z1Wk314UIVcSvnlGDogTOoyOvka0 XNvUcxhZlUuaQchFlCeZI0+3oXRS0w90fq1M+liPp1PI/Dyr8vG78h9PU79Vo0D+SnIV kwbv0tAXzVPaL2Ol1W0CMqhkcdyvApOgV4iboL2qNCZ9LjA0NH5pBqNOHgJYTDC+mQ7d oXyEIy0rR/9+yyy+EWXeBEyK2ClNxkMyV2meERB+sYevow5y09P+eh+zZMAAMd7BxiXu slHg== X-Gm-Message-State: AA6/9RkVO+UNB/vmgvqboWLKLW0bvOPcAJK7X3iNrLOPt5kX25O3YAx9G4gJR/SwzGiUdg== X-Received: by 10.194.149.51 with SMTP id tx19mr6294412wjb.221.1475964848598; Sat, 08 Oct 2016 15:14:08 -0700 (PDT) Received: from ?IPv6:2003:62:5f1b:3000:dd2d:2e5d:c89e:4e66? (p200300625F1B3000DD2D2E5DC89E4E66.dip0.t-ipconnect.de. [2003:62:5f1b:3000:dd2d:2e5d:c89e:4e66]) by smtp.googlemail.com with ESMTPSA id k2sm10228660wmg.23.2016.10.08.15.14.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2016 15:14:08 -0700 (PDT) From: Heiner Kallweit Subject: Re: Commit 1b7898ee276b "powerpc/boot: Use the pre-boot decompression API" breaks boot To: Oliver O'Halloran References: <8db8ecac-4022-7df9-4e81-3d490c50821d@gmail.com> Message-ID: <80c9c42c-45d3-9f24-b3e1-5a5042686b1b@gmail.com> Date: Sun, 9 Oct 2016 00:13:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Am 07.10.2016 um 21:26 schrieb Heiner Kallweit: > Am 07.10.2016 um 07:51 schrieb Oliver O'Halloran: >> Hi, Heiner >> >> Could you send me a copy of the kernel .config (or which defconfig) >> that you're using, the name of the HW platform that you're using and >> if possible the kernel image itself? >> >> Thanks, >> Oliver >> > Thanks for the quick reply. Attached are .config and cuImage. > HW is a TP-Link TL-WDR4900 WiFi router (P1014-based) running OpenWRT. > > Rgds, Heiner > After further checking I think I found the issue. The old gunzip code handled uncompressed data transparently whilst the new one bails out if it doesn't find a proper gzip header. And in my case the actual kernel image is uncompressed. With the following patch the system boots fine again (at least for me). Rgds, Heiner diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c index f7a184b..9796491 100644 --- a/arch/powerpc/boot/main.c +++ b/arch/powerpc/boot/main.c @@ -32,9 +32,16 @@ static struct addr_range prep_kernel(void) void *addr = 0; struct elf_info ei; long len; + int uncompressed_image = 0; - partial_decompress(vmlinuz_addr, vmlinuz_size, + len = partial_decompress(vmlinuz_addr, vmlinuz_size, elfheader, sizeof(elfheader), 0); + /* assume uncompressed data if -1 is returned */ + if (len == -1) { + uncompressed_image = 1; + memcpy(elfheader, vmlinuz_addr, sizeof(elfheader)); + printf("No valid compressed data found, assume uncompressed data\n\r"); + } if (!parse_elf64(elfheader, &ei) && !parse_elf32(elfheader, &ei)) fatal("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); @@ -67,6 +74,12 @@ static struct addr_range prep_kernel(void) "device tree\n\r"); } + if (uncompressed_image) { + memcpy(addr, vmlinuz_addr + ei.elfoffset, ei.loadsize); + printf("%ld bytes of uncompressed data copied\n\r", ei.loadsize); + goto out; + } + /* Finally, decompress the kernel */ printf("Decompressing (0x%p <- 0x%p:0x%p)...\n\r", addr, vmlinuz_addr, vmlinuz_addr+vmlinuz_size); @@ -82,7 +95,7 @@ static struct addr_range prep_kernel(void) len, ei.loadsize); printf("Done! Decompressed 0x%lx bytes\n\r", len); - +out: flush_cache(addr, ei.loadsize); return (struct addr_range){addr, ei.memsize};