From patchwork Mon Nov 12 10:59:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 198359 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7840A2C0086 for ; Mon, 12 Nov 2012 22:00:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ECF004A206; Mon, 12 Nov 2012 12:00:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YH1lrCWMJKjy; Mon, 12 Nov 2012 12:00:00 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 247CB4A1FD; Mon, 12 Nov 2012 11:59:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1AD294A1FD for ; Mon, 12 Nov 2012 11:59:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yUPt8lNMBX2K for ; Mon, 12 Nov 2012 11:59:51 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtpi4.ngi.it (smtpi4.ngi.it [88.149.128.104]) by theia.denx.de (Postfix) with ESMTP id B89CD4A1FA for ; Mon, 12 Nov 2012 11:59:50 +0100 (CET) Received: from babic.homelinux.org (88-149-182-160.v4.ngi.it [88.149.182.160]) by smtpi4.ngi.it (Postfix) with ESMTP id 1364D42461; Mon, 12 Nov 2012 11:59:48 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id C016E4540BE8; Mon, 12 Nov 2012 11:59:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babicengineering.eu Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fAiVNQMd6bKG; Mon, 12 Nov 2012 11:59:42 +0100 (CET) Received: from papero.lan (papero.lan [192.168.2.247]) by babic.homelinux.org (Postfix) with ESMTP id 897864540BD3; Mon, 12 Nov 2012 11:59:41 +0100 (CET) From: Stefano Babic To: u-boot@lists.denx.de Date: Mon, 12 Nov 2012 11:59:39 +0100 Message-Id: <1352717979-6284-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 1.7.9.5 Cc: Marek Vasut , Tom Rini , Otavio Salvador Subject: [U-Boot] [PATCH] Add README for the "Falcon" mode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Simple howto to add support to a board for booting the kernel from SPL ("Falcon" mode). Signed-off-by: Stefano Babic CC: Marek Vasut CC: Otavio Salvador CC: Tom Rini --- doc/README.falcon | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 doc/README.falcon diff --git a/doc/README.falcon b/doc/README.falcon new file mode 100644 index 0000000..d50b8c3 --- /dev/null +++ b/doc/README.falcon @@ -0,0 +1,124 @@ +U-Boot "Falcon" Mode +==================== + +Introduction +------------ + +This documents provides an overview how to add support for "Falcon" mode +to a board. +Falcon mode is introduced to speed up the booting process, allowing +to boot a Linux kernel (or whatever image) without a full blown U-Boot. + +Falcon mode relies on the SPL framework. In fact, to make booting faster, +U-Boot is split into two parts: the SPL (Secondary Program Loader) and U-Boot +image. In mostly implementations, SPL is used to start U-Boot when booting from +a mass storage, such as NAND or SD-Card. SPL has now support for other media, +and can be generalized seen as a way to start an image performing the minimum +required initialization. SPL initializes mainly the RAM controller, and after +that copies U-Boot image into the memory. The "Falcon" mode extends this way +allowing to start any kind of image, an in particular a Linux kernel, preparing +a snapshot of the parameters (ATAG or DT) required by the kernel to boot. + +Falcon adds a command under U-Boot to reuse all code responsible to prepare +the interface with the kernel. In usual U-boot systems, these parameters are +generated each time before loading the kernel, passing to Linux the address +in memory where the parameters can be read. +With falcon, this snapshot can be saved into persistent storage and SPL is +informed to load it before running the kernel. + +To boot the kernel, these steps under a Falcon-aware U-Boot are required: + +1. Boot the board into U-Boot. +Use the "spl export" command to generate the kernel parameters area or the DT. +U-boot runs as when it boots the kernel, but stops before passing the control +to the kernel. + +2. Saves the prepared snapshot into persistent media. +The address where to save it must be configured into board configuration +file (CONFIG_CMD_SPL_NAND_OFS for NAND). + +3. Boot the board into "Falcon" mode. SPL will load the kernel and copy +the parameters area to the address required address. + +It is required to implement a custom mechanism to select if SPL loads U-Boot +or another image. +The value of a GPIO is a simple way to operate the selection, as well as +reading a character from the SPL console if CONFIG_SPL_CONSOLE is set. + +Falcon mode is generally activated by setting CONFIG_SPL_OS_BOOT. This tells +SPL that U-Boot is not the only available image that SPL is able to start. + +Configuration +---------------------------- +CONFIG_CMD_SPL Enable the "spl export" command. + The command "spl export" is then available in U-Boot + mode +CONFIG_SPL_OS_BOOT Activate Falcon mode. + A board should implement the following functions: + +CONFIG_SPL_OS_BOOT_KEY Common name for GPIO used to select between U-Boot + and kernel image. Optional. + +CONFIG_SYS_SPL_ARGS_ADDR Address in RAM where the parameters must be + copied by SPL. + In most cases, it is + 0x100 + +CONFIG_SYS_NAND_SPL_KERNEL_OFFS Offset in NAND where the kernel is stored + +CONFIG_CMD_SPL_NAND_OFS Offset in NAND where the parameters area was saved. + +CONFIG_CMD_SPL_WRITE_SIZE Size of the parameters area to be copied + +Function that a board must implement +------------------------------------ + +void spl_board_prepare_for_linux(void) : optional + Called from SPL before starting the kernel + +spl_start_uboot() : required + Returns "0" if SPL starts the kernel, "1" if U-Boot + must be started. + + +Using spl command +----------------- + +twister => spl +spl - SPL configuration + +Usage: +spl export [kernel_addr] [initrd_addr] [fdt_addr if = fdt] - export a kernel parameter image + initrd_img can be set to "-" if fdt_addr without initrd img isused + +img : "atags" or "fdt" +kernel_addr : kernel is loaded as part of the boot process, but it is not started. + This is the address where a kernel image is stored. +init_addr : optional for atags - the address where the parameters area is generated into RAM +fdt_addr : in case of fdt, the address of the device tree. + +Example (for the twister board): + +twister => spl export atags 0x82000000 +## Booting kernel from Legacy Image at 82000000 ... + Image Name: Linux-3.5.0-rc4-14089-gda0b7f4 + Image Type: ARM Linux Kernel Image (uncompressed) + Data Size: 3654808 Bytes = 3.5 MiB + Load Address: 80008000 + Entry Point: 80008000 + Verifying Checksum ... OK + Loading Kernel Image ... OK +OK +cmdline subcommand not supported +bdt subcommand not supported +Argument image is now in RAM at: 0x80000100 + +The parameters generated with this step can be saved into NAND at the offset +0x800000 (value for twister for CONFIG_CMD_SPL_NAND_OFS) + +Next time, the board can be started into "Falcon mode" moving the +CONFIG_SPL_OS_BOOT_KEY GPIO. +The kernel is loaded directly by the SPL without passing through U-Boot. + +Falcon mode was presented at the RMLL 2011. Slides are available at: + +http://schedule2012.rmll.info/IMG/pdf/LSM2012_UbootFalconMode_Babic.pdf