Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81563C433EF for ; Wed, 22 Dec 2021 09:33:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CAB0982FB5; Wed, 22 Dec 2021 10:33:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=etri.re.kr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=dooray.com header.i=@dooray.com header.b="NN/6PNhB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9BB382FEC; Wed, 22 Dec 2021 10:32:59 +0100 (CET) Received: from mscreen.etri.re.kr (mscreen.etri.re.kr [129.254.9.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F0EDC801EB for ; Wed, 22 Dec 2021 10:32:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=etri.re.kr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ckim@etri.re.kr Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 22 Dec 2021 18:32:49 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: u-boot@lists.denx.de Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id 69d90bab61c2f0c0; Wed, 22 Dec 2021 18:32:48 +0900 DKIM-Signature: a=rsa-sha256; b=NN/6PNhBqUfUez/f92k336/uGsWrsrXDeY3fVGy13z5Fw2iULOlfdQo7Sbqi6CAr3DbdiKVDGV y+PIZBXRHRQPFQV3LEZg4Gwhu05DcR0+NWuPb8Po2u36NdyC1kW3Sb3BL+CA7oorCG+h8hv++v1c pBSnT5h7C9X60EBXUhjJed77ZG8QW6SglLxNW+27f1RKihg/YW2ZOpGZd8kZZG0KbfJs0gdeaIyX P67W1I/RdMdTBP7W9C22eXA5rki/8C0lXb8V7I8kX1qMQiSvrfqZZ5chqeXhPoO4WTNAinS9lZF+ C6FwMOZqp1mW0BiJ3hsH8DZnEPjynpfRojBHpX+g==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=4W1c734HXbWc5iHTT+XU5kdFyFhWCjvGy1jz2URaZ/s=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id 9578d73d61c2f0c0; Wed, 22 Dec 2021 18:32:48 +0900 From: "Chan Kim" To: "U-Boot Mailing List" Subject: In spl falcon mode, and when in BOOT_DEVICE_RAM, why does it 'load' from RAM to RAM? when it's already loaded.. Date: Wed, 22 Dec 2021 18:32:47 +0900 Message-ID: <09b201d7f716$e196b310$a4c41930$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adf3Fn0Gqcagf77YQpi2gA1TB5Mb2w== Content-Language: ko Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.38 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 Hello all, I'm trying booting from RAM using SPL falcon mode. Another scp chip loads the image (FIT image) to SDRAM before u-boot-spl starts. Since the FPGA's DDR interface is not ready, we have on chip 8MB SRAM at the start of DDR address range. (so it's faking DDR) I made a 5.8MiB sized FIT image containing (4.6MiB linux kernel, 8.1KiB dtb, 1.1MB initramfs.cpio.gz). CONFIG_SPL_RAM_SUPPORT and CONFIG_SPL_RAM_DEVICE are both turned on and the spl_boot_list[0] was set to BOOT_DEVICE_RAM. When I run it, at some point it in board_init_r function(common/spl/spl.c), the functions below are called. (A->B means A calls B) Boot_from_devices -> spl_ram_load_image -> spl_load_simple_fit -> spl_simple_fit_read -> spl_get_fit_load_buffer -> malloc. I found in spl_get_fit_load_buffer, it tries to get a buffer the size of the FIT image. I spl_simple_fit_read, before calling spl_get_fit_load_buffer function, I see thise comment. /* * So far we only have one block of data from the FIT. Read the entire * thing, including that first block. * * For FIT with data embedded, data is loaded as part of FIT image. * For FIT with external data, data is not loaded in this step. */ In my case, the whole FIT image is already on (fake) DDR starting at 0x80000000. But the comment sounds like it is reading the remainder into a buffer for that FIT image.(and malloc failed while getting the buffer for that) Why is it allocating the buffer when the whole data is already loaded? Because my fake SDRAM size is only 8MB and the FIT image itself is 5.8MB, I don't have any more big space for the FIT image. I can't figure out what went wrong. (I tried setting CONFIG_SYS_SPL_MALLOC_START and CONFIG_SYS_SPL_MALLOC_SIZE which didn't work. Just no space..) Is there any method I can run it without copying the already loaded FIT image in RAM to another buffer? I think u-boot-spl regards the RAM as a storage media, so it is tryng to 'load' from the 'media' to RAM, when it doesn't need to 'load' it. Thank you for reading and any comment will be really appreciated. Chan Kim