From patchwork Fri Jul 20 12:47:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 142470 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2930045ljj; Fri, 20 Jul 2018 05:54:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDHgM/jFBe7+moRK3mgdC7CC7UKixvKNThXfQm61m7dKuvX1L360ZoWh/yVtel33iiYukN X-Received: by 2002:a50:9ece:: with SMTP id a72-v6mr2566401edf.92.1532091246765; Fri, 20 Jul 2018 05:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532091246; cv=none; d=google.com; s=arc-20160816; b=wxHi4tSLnVUeod7yBpBGy0bG0ag0/chGepZ90sc3xfd6Q0dSNGmfbaoRbPvJ2zo96O mVerFU5N0km1yCnF88vdx6lcY48VgOhzCWgUUz64VyYvgAoOful2GSfRshOZ1KhjOKSw guUwg2RRpuoM2l+0LiI2pCxrXW8K28dXM9gRq40JvlEwEUG16jUnySib9CMNZgLLKV3q tTgQYRDLHDSR3XTCB2KqJkB2L71dRgSPiHjgV07EDc+5NDeJWnXZUpJzBkcmSajBsl2E sTNlaOJEckB8JpUT9un1WGT1JIgAmRfBJQPUwC7OqYAPfCq3GFOquX23tTQwgmSb+LCn HiYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=OI474qQ5Klc0H7LiC+kenTgy5g4o0ukR/tUhYkqHkfM=; b=TMqiuMf7OtAKgoP2OAsF0poE7TyZI1K1UsNCDSpR7sm8ABN8WU1JcZGSXeGa2QV3a+ +nCUgBCmkVgqEDEZJzVPhu52AgdfLJmLZ+2X9ohz8Z3gDyYjayPJ/o5Bsqsx6guTV+6B JrSwC90hgudeyGbIl7Hzd6mylBlJWgZ5B597Hu3UreiYpd/5aMP6i/w56zWLX4j7i25G tpNK2pVxB0/w9II++8TZQwldLuWUIVFiFuURig4ggBpz5k7OYHV17FkwC/C5D2y2g4QV av4T0Ktsk9jrIqMpPxXFmeP/BF+7eDclruz+MNLGgWHAremOkccko49GtLwFkThzlsaD xgPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=ipBgL1vc; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id q8-v6si1771746edn.6.2018.07.20.05.54.06; Fri, 20 Jul 2018 05:54:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=ipBgL1vc; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 60723C21F2A; Fri, 20 Jul 2018 12:50:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A4237C21F81; Fri, 20 Jul 2018 12:50:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C35BEC21EF2; Fri, 20 Jul 2018 12:47:44 +0000 (UTC) Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by lists.denx.de (Postfix) with ESMTPS id E1095C21F34 for ; Fri, 20 Jul 2018 12:47:41 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w6KClLDP006005; Fri, 20 Jul 2018 21:47:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w6KClLDP006005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532090841; bh=O7FtEJ2eo9QlzG8w3BE1FSBxf7TOErMmmH9dN+HenrA=; h=From:To:Cc:Subject:Date:From; b=ipBgL1vcteA3YKpzoBd63FztFbGcmqGw2LSdGU1jyyh6Xq6vBdJ+UvfHftgNbb7Bs XlHmGeTTGu5OJGSEiPavIEj0KiR6bsaSGUwdJjU5h/aSbl7772SBF7EmU9gJLmwAnK xwpEQTcd22wBFl90r1Tlvx2oyCF2JB+DtFNZ8IYui+wBkPRAykEbHBdxUgYT8EAdSz QKxaxFkiUaSswERd830jxq+jSOqi0+AATe773pmzNo6wzeKAYzYQzT3IzDWg6b90v/ qY8qEtwgHkj6ci2ZaCzn6+ea8uLBYmRb8XLOoWpcOlImW0ZupqhWtsW9vSvCk4rOkG 7c2crmPUdwSpQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Fri, 20 Jul 2018 21:47:18 +0900 Message-Id: <1532090838-24809-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Tom Rini Subject: [U-Boot] [PATCH] ARM: uniphier: enable distro boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Switch to the distro boot for UniPhier platform. - Remove the environment vairalbes used to load images from raw block devices. - Keep the command to download images via tftp. This will be useful to boot the kernel when no valid kernel image is ready yet in the file system. - Use root.cpio.gz instead of root.cpio.uboot because we always know the file size of the init ramdisk; it is loaded via either a file system or network. - Rename fit_addr_r to kernel_addr_r, which the distro command checks to get the load address of FIT image. Signed-off-by: Masahiro Yamada --- arch/arm/Kconfig | 1 + arch/arm/mach-uniphier/board_late_init.c | 8 +-- doc/README.uniphier | 55 +++++++++++++++++++++ include/configs/uniphier.h | 84 +++++++++++++++----------------- 4 files changed, 100 insertions(+), 48 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5b3746c..56956c7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1231,6 +1231,7 @@ config ARCH_UNIPHIER select SPL_OF_CONTROL if SPL select SPL_PINCTRL if SPL select SUPPORT_SPL + imply DISTRO_DEFAULTS imply FAT_WRITE help Support for UniPhier SoC family developed by Socionext Inc. diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c index 6a99572..8ffb9a8 100644 --- a/arch/arm/mach-uniphier/board_late_init.c +++ b/arch/arm/mach-uniphier/board_late_init.c @@ -66,20 +66,20 @@ int board_late_init(void) switch (uniphier_boot_device_raw()) { case BOOT_DEVICE_MMC1: printf("eMMC Boot"); - env_set("bootmode", "emmcboot"); + env_set("bootcmd", "run bootcmd_mmc0; run distro_bootcmd"); break; case BOOT_DEVICE_NAND: printf("NAND Boot"); - env_set("bootmode", "nandboot"); + env_set("bootcmd", "run bootcmd_ubifs0; run distro_bootcmd"); nand_denali_wp_disable(); break; case BOOT_DEVICE_NOR: printf("NOR Boot"); - env_set("bootmode", "norboot"); + env_set("bootcmd", "run tftpboot; run distro_bootcmd"); break; case BOOT_DEVICE_USB: printf("USB Boot"); - env_set("bootmode", "usbboot"); + env_set("bootcmd", "run bootcmd_usb0; run distro_bootcmd"); break; default: printf("Unknown"); diff --git a/doc/README.uniphier b/doc/README.uniphier index 990806a..badfacd 100644 --- a/doc/README.uniphier +++ b/doc/README.uniphier @@ -332,6 +332,61 @@ for kernel, DTB, and Init ramdisk. If they are not displayed, the Verified Boot is not working. +Deployment for Distro Boot +-------------------------- + +UniPhier SoC family boot the kernel in a generic manner as described in +doc/README.distro . + +To boot the kernel, you need to deploy necesssary components to a file +system on one of your block devices (eMMC, NAND, USB drive, etc.). + +The components depend on the kernel image format. + +[1] Bare images + + - kernel + - init ramdisk + - device tree blob + - boot configuration file (extlinux.conf) + +Here is an exmple of the configuration file. + +-------------------->8-------------------- +menu title UniPhier Boot Options. + +timeout 50 +default UniPhier + +label UniPhier + kernel ../Image + initrd ../rootfs.cpio.gz + fdtdir .. +-------------------->8-------------------- + +Then, write 'Image', 'rootfs.cpio.gz', 'uniphier-ld20-ref.dtb' (DTB depends on +your board), and 'extlinux/extlinux.conf' to the file system. + +[2] FIT + + - FIT blob + - boot configuration file (extlinux.conf) + +-------------------->8-------------------- +menu title UniPhier Boot Options. + +timeout 50 +default UniPhier + +label UniPhier + kernel ../fitImage +-------------------->8-------------------- + +Since the init ramdisk and DTB are contained in the FIT blob, +you do not need to describe them in the configuration file. +Write 'fitImage' and 'extlinux/extlinux.conf' to the file system. + + UniPhier specific commands -------------------------- diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index b631f79..3c46a6e 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -10,6 +10,35 @@ #ifndef __CONFIG_UNIPHIER_COMMON_H__ #define __CONFIG_UNIPHIER_COMMON_H__ +#ifndef CONFIG_SPL_BUILD +#include + +#ifdef CONFIG_CMD_MMC +#define BOOT_TARGET_DEVICE_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) +#else +#define BOOT_TARGET_DEVICE_MMC(func) +#endif + +#ifdef CONFIG_CMD_UBIFS +#define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0) +#else +#define BOOT_TARGET_DEVICE_UBIFS(func) +#endif + +#ifdef CONFIG_CMD_USB +#define BOOT_TARGET_DEVICE_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICE_USB(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_DEVICE_MMC(func) \ + BOOT_TARGET_DEVICE_UBIFS(func) \ + BOOT_TARGET_DEVICE_USB(func) +#else +#define BOOTENV +#endif + #define CONFIG_ARMV7_PSCI_1_0 /*----------------------------------------------------------------------- @@ -99,8 +128,6 @@ "third_image=u-boot.bin\0" #endif -#define CONFIG_BOOTCOMMAND "run $bootmode" - #define CONFIG_ROOTPATH "/nfs/root/path" #define CONFIG_NFSBOOTCOMMAND \ "setenv bootargs $bootargs root=/dev/nfs rw " \ @@ -111,64 +138,31 @@ #ifdef CONFIG_FIT #define CONFIG_BOOTFILE "fitImage" #define LINUXBOOT_ENV_SETTINGS \ - "fit_addr=0x00100000\0" \ - "fit_addr_r=0x85100000\0" \ - "fit_size=0x00f00000\0" \ - "norboot=setexpr fit_addr $nor_base + $fit_addr &&" \ - "bootm $fit_addr\0" \ - "nandboot=nand read $fit_addr_r $fit_addr $fit_size &&" \ - "bootm $fit_addr_r\0" \ - "tftpboot=tftpboot $fit_addr_r $bootfile &&" \ - "bootm $fit_addr_r\0" \ + "kernel_addr_r=0x85100000\0" \ + "tftpboot=tftpboot $kernel_addr_r $bootfile &&" \ + "bootm $kernel_addr_r\0" \ "__nfsboot=run tftpboot\0" #else #ifdef CONFIG_ARM64 -#define CONFIG_BOOTFILE "Image.gz" +#define CONFIG_BOOTFILE "Image" #define LINUXBOOT_CMD "booti" -#define KERNEL_ADDR_LOAD "kernel_addr_load=0x85200000\0" #define KERNEL_ADDR_R "kernel_addr_r=0x82080000\0" #else #define CONFIG_BOOTFILE "zImage" #define LINUXBOOT_CMD "bootz" -#define KERNEL_ADDR_LOAD "kernel_addr_load=0x80208000\0" #define KERNEL_ADDR_R "kernel_addr_r=0x80208000\0" #endif #define LINUXBOOT_ENV_SETTINGS \ - "fdt_addr=0x00100000\0" \ "fdt_addr_r=0x85100000\0" \ - "fdt_size=0x00008000\0" \ - "kernel_addr=0x00200000\0" \ - KERNEL_ADDR_LOAD \ KERNEL_ADDR_R \ - "kernel_size=0x00e00000\0" \ - "ramdisk_addr=0x01000000\0" \ "ramdisk_addr_r=0x86000000\0" \ - "ramdisk_size=0x00800000\0" \ - "ramdisk_file=rootfs.cpio.uboot\0" \ + "ramdisk_file=rootfs.cpio.gz\0" \ "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \ - "if test $kernel_addr_load = $kernel_addr_r; then " \ - "true; " \ - "else " \ - "unzip $kernel_addr_load $kernel_addr_r; " \ - "fi && " \ LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \ - "norboot=setexpr kernel_addr_nor $nor_base + $kernel_addr && " \ - "setexpr kernel_size_div4 $kernel_size / 4 && " \ - "cp $kernel_addr_nor $kernel_addr_load $kernel_size_div4 && " \ - "setexpr ramdisk_addr_nor $nor_base + $ramdisk_addr && " \ - "setexpr ramdisk_size_div4 $ramdisk_size / 4 && " \ - "cp $ramdisk_addr_nor $ramdisk_addr_r $ramdisk_size_div4 && " \ - "setexpr fdt_addr_nor $nor_base + $fdt_addr && " \ - "setexpr fdt_size_div4 $fdt_size / 4 && " \ - "cp $fdt_addr_nor $fdt_addr_r $fdt_size_div4 && " \ - "run boot_common\0" \ - "nandboot=nand read $kernel_addr_load $kernel_addr $kernel_size && " \ - "nand read $ramdisk_addr_r $ramdisk_addr $ramdisk_size &&" \ - "nand read $fdt_addr_r $fdt_addr $fdt_size &&" \ - "run boot_common\0" \ - "tftpboot=tftpboot $kernel_addr_load $bootfile && " \ - "tftpboot $ramdisk_addr_r $ramdisk_file &&" \ + "tftpboot=tftpboot $kernel_addr_r $bootfile && " \ "tftpboot $fdt_addr_r $fdtfile &&" \ + "tftpboot $ramdisk_addr_r $ramdisk_file &&" \ + "setenv ramdisk_addr_r $ramdisk_addr_r:$filesize &&" \ "run boot_common\0" \ "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \ "tftpboot $fdt_addr_r $fdtfile &&" \ @@ -179,6 +173,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "netdev=eth0\0" \ "initrd_high=0xffffffffffffffff\0" \ + "scriptaddr=0x85000000\0" \ "nor_base=0x42000000\0" \ "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \ "tftpboot $tmp_addr $second_image && " \ @@ -202,7 +197,8 @@ "tftpboot $third_image && " \ "usb write $loadaddr 100 f00\0" \ BOOT_IMAGES \ - LINUXBOOT_ENV_SETTINGS + LINUXBOOT_ENV_SETTINGS \ + BOOTENV #define CONFIG_SYS_BOOTMAPSZ 0x20000000