From patchwork Sat Jan 8 05:18:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg Gast X-Patchwork-Id: 1577328 X-Patchwork-Delegate: pbrobinson@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JWZCy4xyCz9s1l for ; Sun, 9 Jan 2022 09:15:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F52A836C5; Sat, 8 Jan 2022 23:15:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=schorsch-tech.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id B326A82DB7; Sat, 8 Jan 2022 06:18:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from mail.schorsch-tech.de (unknown [IPv6:2a01:4f8:c2c:2f05::1]) by phobos.denx.de (Postfix) with ESMTP id 3430480A4F for ; Sat, 8 Jan 2022 06:18:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=schorsch-tech.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=georg@schorsch-tech.de Received: from internal-mail.schorsch-tech.de (unknown [IPv6:fd13:6b90:5163:20::13]) by mail.schorsch-tech.de (Postfix) with ESMTP id E0D193E91B for ; Sat, 8 Jan 2022 06:18:13 +0100 (CET) Received: from [192.168.160.19] (unknown [192.168.160.19]) by internal-mail.schorsch-tech.de (Postfix) with ESMTPSA id BC9A3332417 for ; Sat, 8 Jan 2022 06:18:12 +0100 (CET) Message-ID: <4651700a-cfbc-093b-a351-a184ea8ed901@schorsch-tech.de> Date: Sat, 8 Jan 2022 06:18:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US To: u-boot@lists.denx.de From: Georg Gast Subject: [PATCH] Enable RaspberryPi arm64 to netboot a compressed kernel image X-Mailman-Approved-At: Sat, 08 Jan 2022 23:15:20 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This changes add - kernel_comp_addr_r=0x0800000 - kernel_comp_size=0x0800000 to the default environment of the raspberry pi. With these two options u-boot can uncompress a received compressed kernel and boot it. I could just test these changes on raspberry pi 4B with 8GB of ram. See the attached logs. U-Boot 2021.10-dirty (Jan 08 2022 - 05:57:42 +0100) DRAM: 7.9 GiB RPI 4 Model B (0xd03114) MMC: mmc@7e300000: 0, mmc@7e340000: 1 Loading Environment from FAT... Card did not respond to voltage select! : -110 In: serial Out: vidconsole Err: vidconsole Net: eth0: ethernet@7d580000 PCIe BRCM: link up, 5.0 Gbps x1 (SSC) starting USB... Bus usb@7e980000: USB DWC2 Bus xhci_pci: Register 5000420 NbrPorts 5 Starting the controller USB XHCI 1.00 scanning bus usb@7e980000 for devices... 1 USB Device(s) found scanning bus xhci_pci for devices... Failed to get keyboard state from device 1997:2433 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 U-Boot> setenv boot_targets "dhcp pxe" U-Boot> boot georg@rpi64-test:~$ dmesg [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083] [ 0.000000] Linux version 5.15.10-rt24-v8 (georg@hammerhead) (aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT_RT Wed Jan 5 21:06:46 CET 2022 [ 0.000000] Machine model: Raspberry Pi 4 Model B Rev 1.4 [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000037400000, size 64 MiB [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000000000-0x000000003fffffff] [ 0.000000] DMA32 [mem 0x0000000040000000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x00000001ffffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000003b3fffff] [ 0.000000] node 0: [mem 0x0000000040000000-0x00000000fbffffff] [ 0.000000] node 0: [mem 0x0000000100000000-0x00000001ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000001ffffffff] [ 0.000000] percpu: Embedded 27 pages/cpu s73392 r8192 d29008 u110592 [ 0.000000] pcpu-alloc: s73392 r8192 d29008 u110592 alloc=27*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Detected PIPT I-cache on CPU0 [ 0.000000] CPU features: detected: Spectre-v2 [ 0.000000] CPU features: detected: Spectre-v4 [ 0.000000] CPU features: detected: ARM errata 1165522, 1319367, or 1530923 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2028848 [ 0.000000] Kernel command line: rw console=ttyAMA0,115200u8 console=tty1 earlyprintk root=/dev/nfs nfsroot=192.168.160.19:/srv/netboot/rpi64/rootfs ip=192.168.160.42:192.168.160.19:192.168.160.1::rpi64-test.schorsch-tech.de nfsrootdebug [ 0.000000] Unknown kernel command line parameters "earlyprintk nfsrootdebug", will be passed to user space. From 41099ae6902a3f48f66cd36b009a2847ec61a5ae Mon Sep 17 00:00:00 2001 From: Georg Gast Date: Sat, 8 Jan 2022 06:01:19 +0100 Subject: [PATCH] Enable RaspberryPi arm64 to netboot a compressed kernel image. This changes add - kernel_comp_addr_r=0x0800000 - kernel_comp_size=0x0800000 to the default environment of the raspberry pi. With these two options u-boot can uncompress a received compressed kernel and boot it. I could just test these changes on raspberry pi 4B with 8GB of ram. See the attached logs. U-Boot 2021.10-dirty (Jan 08 2022 - 05:57:42 +0100) DRAM: 7.9 GiB RPI 4 Model B (0xd03114) MMC: mmc@7e300000: 0, mmc@7e340000: 1 Loading Environment from FAT... Card did not respond to voltage select! : -110 In: serial Out: vidconsole Err: vidconsole Net: eth0: ethernet@7d580000 PCIe BRCM: link up, 5.0 Gbps x1 (SSC) starting USB... Bus usb@7e980000: USB DWC2 Bus xhci_pci: Register 5000420 NbrPorts 5 Starting the controller USB XHCI 1.00 scanning bus usb@7e980000 for devices... 1 USB Device(s) found scanning bus xhci_pci for devices... Failed to get keyboard state from device 1997:2433 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 U-Boot> setenv boot_targets "dhcp pxe" U-Boot> boot georg@rpi64-test:~$ dmesg [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083] [ 0.000000] Linux version 5.15.10-rt24-v8 (georg@hammerhead) (aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT_RT Wed Jan 5 21:06:46 CET 2022 [ 0.000000] Machine model: Raspberry Pi 4 Model B Rev 1.4 [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000037400000, size 64 MiB [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000000000-0x000000003fffffff] [ 0.000000] DMA32 [mem 0x0000000040000000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x00000001ffffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000003b3fffff] [ 0.000000] node 0: [mem 0x0000000040000000-0x00000000fbffffff] [ 0.000000] node 0: [mem 0x0000000100000000-0x00000001ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000001ffffffff] [ 0.000000] percpu: Embedded 27 pages/cpu s73392 r8192 d29008 u110592 [ 0.000000] pcpu-alloc: s73392 r8192 d29008 u110592 alloc=27*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Detected PIPT I-cache on CPU0 [ 0.000000] CPU features: detected: Spectre-v2 [ 0.000000] CPU features: detected: Spectre-v4 [ 0.000000] CPU features: detected: ARM errata 1165522, 1319367, or 1530923 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2028848 [ 0.000000] Kernel command line: rw console=ttyAMA0,115200u8 console=tty1 earlyprintk root=/dev/nfs nfsroot=192.168.160.19:/srv/netboot/rpi64/rootfs ip=192.168.160.42:192.168.160.19:192.168.160.1::rpi64-test.schorsch-tech.de nfsrootdebug [ 0.000000] Unknown kernel command line parameters "earlyprintk nfsrootdebug", will be passed to user space. --- include/configs/rpi.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 522b41c02d..4f106643ac 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -151,6 +151,9 @@ * Even with the smallest possible CPU-GPU memory split of the CPU getting * only 64M, the remaining 25M starting at 0x02700000 should allow quite * large initrds before they start colliding with U-Boot. + * + * The kernel uncompression area is placed at 0x0800000 with 0x0800000 bytes. + * Even the first rpi had just 256M of RAM. This should be still work on it. */ #define ENV_MEM_LAYOUT_SETTINGS \ "fdt_high=" FDT_HIGH "\0" \ @@ -159,7 +162,9 @@ "scriptaddr=0x02400000\0" \ "pxefile_addr_r=0x02500000\0" \ "fdt_addr_r=0x02600000\0" \ - "ramdisk_addr_r=0x02700000\0" + "ramdisk_addr_r=0x02700000\0" \ + "kernel_comp_addr_r=0x0800000\0" \ + "kernel_comp_size=0x0800000\0" #if CONFIG_IS_ENABLED(CMD_MMC) #define BOOT_TARGET_MMC(func) \ -- 2.30.2