From owner-freebsd-arm@freebsd.org Tue Dec 22 03:48:59 2015 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 DA330A4C159 for ; Tue, 22 Dec 2015 03:48:59 +0000 (UTC) (envelope-from sylgar@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 65A8C17E0 for ; Tue, 22 Dec 2015 03:48:59 +0000 (UTC) (envelope-from sylgar@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id p187so93969250wmp.0 for ; Mon, 21 Dec 2015 19:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=dIaqdr+FqTwKxw9thbQe9hzK6u9eRjqxWR9HDrLrDro=; b=ISBopy0/V+gJiFIOZyGzfM25lNozWpsoh8XY5fKAXuDAhQJ7UmVQ6t+Q+bLyVvIx7N gun52PeLurI7mviSLDmgwB5r13bu1hE9/hJniuB9CEzaERemU1wFuz4vwoERfOxCbBGm aeYTTDX0I6Hon5TqNOiX9xRk8xONLiQtVblWRih2djZkiHb8Is1ST+spXok3wPw+k58q lG+2T5SDxtPEIt5Wicqg4yfuUqp2XFZzHqVzdUN6Z/VHKP8erSKxZbxtKpslSOKDvSDT DtrTZYvXVvm+ijQ8UA9pmYawsxNjVFm/AyN5EAgjKzfvtLDlvxi/xr5/+QrRugfvV9lL rAbQ== X-Received: by 10.194.236.6 with SMTP id uq6mr24535736wjc.126.1450756137746; Mon, 21 Dec 2015 19:48:57 -0800 (PST) Received: from [192.168.0.5] (lns-bzn-50f-81-56-235-196.adsl.proxad.net. [81.56.235.196]) by smtp.gmail.com with ESMTPSA id 198sm22896336wmr.18.2015.12.21.19.48.56 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Dec 2015 19:48:56 -0800 (PST) From: Sylvain Garrigues Subject: Booting the ELF kernel without ubldr on Raspberry Pi Message-Id: Date: Tue, 22 Dec 2015 04:48:55 +0100 To: freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) X-Mailer: Apple Mail (2.3112) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2015 03:48:59 -0000 Hello, I=E2=80=99d like to boot FreeBSD directly with u-boot, without ubldr, = using an image provided by the u-boot mkimage tool. The reason is = simple: mkimage can deal with compressed kernels and will therefore = speed my boot time. And I want to try it anyway, as it seems possible = reading = http://bsdcan.org/2008/schedule/attachments/49_2008_uboot_freebsd.pdf = = and various other=20 Before going there and using an mkimage, I=E2=80=99d like to boot the = kernel image just with the same bootelf version provided by the = sysutils/u-boot-rpi2 port. It doesn=E2=80=99t display anything and = crashes (I think I can see =C2=AB illegal instruction =C2=BB just before = the board reboots). I don=E2=80=99t understand why, and this is my first = question. Then I looked at the mkimage utility, although we can specify and = freebsd kernel type through the -O flag, the bootm command only = understands linux and NetBSD. I guess I should use linux there? Thanks for your help, Sylvain PS: FYI, below is: 1/ info about my kernel (I can see the entry point is at 0xc0100100), = copied into the fat partition # readelf -h = /root/crochet/work/obj/arm.armv6/root/crochet/src/sys/RPI2/kernel = =20 ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00=20 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0xc0100100 Start of program headers: 52 (bytes into file) Start of section headers: 6235080 (bytes into file) Flags: 0x5000202, has entry point, = Version5 EABI, Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 6 Size of section headers: 40 (bytes) Number of section headers: 38 Section header string table index: 35 [root@clad /usr/ports/sysutils/u-boot-rpi2]# =20 2/ the interesting part of my include/configs/rpi-common.h from u-boot: #define CONFIG_EXTRA_ENV_SETTINGS \ ENV_DEVICE_SETTINGS \ "loadaddr=3D0x02000000\0" \ "Fatboot=3D" \ "env exists loaderdev || env set loaderdev ${fatdev}; " \ "echo Booting from: ${fatdev} ${bootfile}; " \ "fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf = ${loadaddr}; " \ "\0" \ "preboot=3D" \ "fdt addr 0x100; " \ "env set bootfile kernel; " \ =20 "env set fatdev 'mmc 0'; " \ "\0" #undef CONFIG_BOOTCOMMAND #define CONFIG_BOOTCOMMAND "run Fatboot" #undef CONFIG_PREBOOT #define CONFIG_PREBOOT "run preboot"=