From owner-freebsd-arm@freebsd.org Sat Jun 24 15:15:46 2017 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 23A53DA06FB for ; Sat, 24 Jun 2017 15:15:46 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F38E6F944 for ; Sat, 24 Jun 2017 15:15:45 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 08db13d1; Sat, 24 Jun 2017 17:15:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=YTwgelJlZTMYrWQa0ZGcmFdRzSg=; b=fBfNTILjB2HrXu8wyPoUI313j6c7 zpf/xaoO80XidkywbXyC8wrVFbBj6vmSvR5RAJRxMneWH29tA3R7dsBCyhQPcLRM s1Jj/TEchBao8P0qy5igqWu89sVKjHYaVMxfZB6wHWWMKtvq5pkdJWwhBXjWxwv4 EWUHu5ozh12OQSw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=GNnmq+I8pnbG+zog8J6JaBvqVFT6ASarZnEOxw/MIi19BryVdpXBPOA0 yZ4E+TDT7KXHOA//sHJ2SjQJEidKWVY5oTwbkX28r3A16+4tKsJoT9ofA14p+dzY SFP9V4/+zlX2zHUJjHfNMKbIAo+2sFd0nYUQXm/in2AvTpeVDPA= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 57810d43 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 24 Jun 2017 17:15:42 +0200 (CEST) Date: Sat, 24 Jun 2017 17:15:39 +0200 From: Emmanuel Vadot To: Johnny Sorocil Cc: freebsd-arm@freebsd.org Subject: Re: Orange Pi Zero support Message-Id: <20170624171539.3b6a73b245b05e649a62933c@bidouilliste.com> In-Reply-To: References: X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jun 2017 15:15:46 -0000 On Sat, 24 Jun 2017 13:13:40 +0200 Johnny Sorocil wrote: > Hi all! > > I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC). > > I have few questions: > 1) How to build vanilla u-boot which will be capable booting FreeBSD > kernel? I have managed to load ubldr, but not the kernel. The easiest way is to use my github fork (https://github.com/evadot/u-boot/tree/freebsd) This have all the patches for FreeBSD that haven't made upstream yet. As soon as U-Boot 2017.07 is out (it should be out on July 10th) I'll create a new branch on the FreeBSD fork (https://github.com/freebsd/u-boot). Step to compile U-Boot: export CROSS_COMPILE=arm-none-eabi- gmake board_defconfig gmake menuconfig (and select "Enable FreeBSD boot") gmake > 2) How to use newer Linux dts/dtb files? For Allwinner it's straight forward, with a few exception we use the Linux DTS untouched. > 1) u-boot > This is how I built u-boot: > git clone git://git.denx.de/u-boot.git > cd u-boot > git checkout v2017.05 > # apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1) > (in the attachment) > gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig > gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- > dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024 > seek=8 > > In the u-boot prompt: > fatload mmc 0 0x42000000 ubldr.bin > setenv fdtfile sun8i-h3-orangepi-one.dtb > go 0x4200000 > ubldr will work as expected, but kernel will hang at the start. > If I use > /usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then > the kernel and userland will boot normally. > This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab) > > 2) newer DTS/DTB > If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board > will boot fine, but I don't have network. > I can also boot normally if the dtb file is rebuilt manually: > cd /usr/src/sys/gnu/dts/arm > cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include > sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb > ls -lh sun8i-h3-rebuilt.dtb > -rw-r--r-- 1 root wheel 15K Jun 24 13:02 sun8i-h3-rebuilt.dtb > But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang: > Using DTB from loaded file > 'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'. > Kernel entry at 0x42200100... > Kernel args: -v > The same file boots Linux without problems. > > I don't know why newer dtb files won't work because there is no output on > serial console. > Any ideas how to make it work? There is nothing on the serial console because we miss the h2 definition in aw_machdep.c I've started to add proper support for it today but there is some problems with some old clocks drivers. I'm currently patching them and hope to commit H2Plus support today or tomorow. Cheers, -- Emmanuel Vadot