From patchwork Tue Nov 1 09:50:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Weisser X-Patchwork-Id: 123050 X-Patchwork-Delegate: vapier@gentoo.org 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 C957CB6F65 for ; Tue, 1 Nov 2011 20:50:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6667429118; Tue, 1 Nov 2011 10:50:18 +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 OndLdMJQaBdP; Tue, 1 Nov 2011 10:50:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 668B7290F1; Tue, 1 Nov 2011 10:50:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DA026290F1 for ; Tue, 1 Nov 2011 10:50:13 +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 OchqDHSyL8zg for ; Tue, 1 Nov 2011 10:50:12 +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 mail-in-13.arcor-online.net (mail-in-13.arcor-online.net [151.189.21.53]) by theia.denx.de (Postfix) with ESMTPS id 2164D290B7 for ; Tue, 1 Nov 2011 10:50:10 +0100 (CET) Received: from mail-in-15-z2.arcor-online.net (mail-in-15-z2.arcor-online.net [151.189.8.32]) by mx.arcor.de (Postfix) with ESMTP id 6EB45212686; Tue, 1 Nov 2011 10:50:09 +0100 (CET) Received: from mail-in-15.arcor-online.net (mail-in-15.arcor-online.net [151.189.21.55]) by mail-in-15-z2.arcor-online.net (Postfix) with ESMTP id 6A4C733E11B; Tue, 1 Nov 2011 10:50:09 +0100 (CET) Received: from [192.168.178.33] (HSI-KBW-078-042-175-106.hsi3.kabel-badenwuerttemberg.de [78.42.175.106]) (Authenticated sender: weisserm@arcor.de) by mail-in-15.arcor-online.net (Postfix) with ESMTPA id 4F7691AB844; Tue, 1 Nov 2011 10:50:09 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-15.arcor-online.net 4F7691AB844 Message-ID: <4EAFC0D8.6030407@arcor.de> Date: Tue, 01 Nov 2011 10:50:16 +0100 From: Matthias Weisser User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: sjg@chromium.org Cc: u-boot@lists.denx.de Subject: [U-Boot] sandbox: Crash on startup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Dear Simon I just wanted to play around with the sandbox "arch" of u-boot maybe adding tun/tap support. Current head compiled successfully but crashed immediately after startup in board_init_f: gd = malloc(sizeof(gd_t)); assert(gd); memset((void *)gd, 0, sizeof(gd_t)); The simple reason was that malloc refers to u-boots internal malloc which is not initialized at this point. I added the following snippet building u-boot from current head? Wouldn't it be a better approach to use the internal malloc of u-boot and acquire some memory from the system using mmap? Regards Matthias diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 685793e..c98ca61 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -21,8 +21,12 @@ #include +static uint8_t malloc_area[1024*1024*256]; + int main(int argc, char *argv[]) { + mem_malloc_init(malloc_area, sizeof(malloc_area)); + /* and got the console working. Can you tell me what I am doing wrong when