From owner-freebsd-arm@freebsd.org Thu Mar 24 15:29:51 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 010F6ADC0AC for ; Thu, 24 Mar 2016 15:29:51 +0000 (UTC) (envelope-from sylgar@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D8F01A6B for ; Thu, 24 Mar 2016 15:29:50 +0000 (UTC) (envelope-from sylgar@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id p65so71149313wmp.0 for ; Thu, 24 Mar 2016 08:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:message-id:date:to:mime-version; bh=ZPLw3jvR44lT7InjEDKFy5Fnut7/vSlyOprs/JIbv2w=; b=wfwWE7vu5VLkGqqirTapHuf7zUGJ/yp3MGGFnUCjQFzIVN1kCcE1/7BwzEcsmrz6PM 18k+ODQU6SrCoutchkISPJmCOzbQdSTKR0Pw5EMArj+9nm8lcIRKjF17Mgjb8zoeSCbX 6FB23txohBXskueCdHnoxfnBjBMv5ByLHB0Bw637zU8cZ+urQCI8enqOhlO++hFNOLzN FBALZUJ4wyiLP0ClG/XSsk2a44Zmsef8A6+GnySWxUVTOk9w99DFOzNNvKTl/3y+dRiY e8SO18WIIa0a+mNytEThHzOwm1X0eikOPglIsHE3aV903xSqltFBkUWFPqo7ohmkSe+1 7PKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:message-id:date:to:mime-version; bh=ZPLw3jvR44lT7InjEDKFy5Fnut7/vSlyOprs/JIbv2w=; b=NMXgb++6E1HlxyvQ/w/NyznjeNqVeGMTTufHfq2gxPlZmwjmFI2m+EltpqAlq/4BV3 EZ/2wcpiPft6fwIdOPmSwCygWq9tTBJUR/XxVJ1UkALOwe3Jdtp3pjXEfFPfr5d04cjs NroyZuzSEj3MMBOziQvYsCcy256snJnixWyJkQ/pVARCXgdP41to8BAXVNqev3QbJZsy FxjxEc5bn6N6pgSCyKxMtfohe7cw5ACREHbSJmF45uwZiDKeQ3C5pKhzleUJHR32pcP8 giWJUJdbvCUZT0K3tSxlRcdbbtUZPx5ajoJwQAEdqAsepRHtPfaEcUf3m4RbN1pgULUs 2iQQ== X-Gm-Message-State: AD7BkJKArdn/Cm56mQ+YWY7A/qQQsGXGjm15ajj3yZ13kZ7u3LPxJknsIKzIQstfOzCGBQ== X-Received: by 10.194.201.166 with SMTP id kb6mr10750502wjc.125.1458833368839; Thu, 24 Mar 2016 08:29:28 -0700 (PDT) Received: from [192.168.0.4] ([81.56.235.196]) by smtp.gmail.com with ESMTPSA id y72sm8255510wmh.21.2016.03.24.08.29.26 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Mar 2016 08:29:27 -0700 (PDT) From: Sylvain Garrigues Subject: Booting kernel.bin directly on Raspberry Pi / external DTB support Message-Id: <1CCA59DC-5539-4CFB-81BA-0112E2120B3B@gmail.com> Date: Thu, 24 Mar 2016 16:29:26 +0100 To: freebsd-arm Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2016 15:29:51 -0000 Hello, I have written a small (ugly) patch to be able to boot a kernel directly = without the ubldr loader while still using an external DTB (Linux-style = booting may pass the DTB location pointer in the r2 register). The patch is here: https://reviews.freebsd.org/differential/diff/14577/=20= I tested my patch successfully with the QEMU emulator with the -dtb = option available in recent versions, using a VERSATILEPB kernel without = FDT_STATIC. # qemu-system-arm -M versatilepb -m 128M -kernel versatile.flash -cpu = arm1176 -dtb versatilepb.dtb FYI, once the kernel is built, here is the script to build the = versatile.flash (adapted from gonzo, no longer need to clear the r0-r3 = registers): https://reviews.freebsd.org/P92 = I also tested successfully my patch on my Raspberry Pi 2 using U-BOOT = and the RPI2 kernel with my patch applied (and the LINUX_BOOT_ABI = option): u-boot> fatload mmc 0 0x200000 kernel.bin u-boot> go 0x200000 That works. So now I thought I could even bypass u-boot and launch kernel.bin = directly from the Pi firmware=E2=80=A6 But it doesn=E2=80=99t work, I = don=E2=80=99t understand why, and that is why I am writing here. Here is the config.txt which I thought would work: kernel=3Dkernel.bin (instead of u-boot.bin) kernel_address=3D0x200000 (line added because a FreeBSD kernel needs to = be loaded on a 1MB or 2MB boundary) device_tree=3Drpi2.dtb device_tree_address=3D0x100 disable_commandline_tags=3D1 What am I missing? Is it even possible to boot kernel.bin directly on = the Pi (with my patch)? I found this static minimalist loader from = Andrew here: = https://github.com/freebsd/freebsd/commit/074d37d46c3f9b282cd2d849d997b1b3= 9acd710c = - does it mean such a loader is necessary before the kernel? Thanks, Sylvain PS: I know the =C2=AB official and supported =C2=BB way of booting = FreeBSD on the Pi is the u-boot + ubldr combination. I just would like = to finish this experiment and understand why kernel.bin cannot be booted = directly.=