From owner-freebsd-arm@freebsd.org Tue Nov 22 11:27:52 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 3D9A0C4F56C for ; Tue, 22 Nov 2016 11:27:52 +0000 (UTC) (envelope-from vova@fbsd.ru) Received: from fbsd.ru (mx.fbsd.ru [178.213.227.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2B7A1AC5 for ; Tue, 22 Nov 2016 11:27:51 +0000 (UTC) (envelope-from vova@fbsd.ru) Received: from [185.152.193.239] (helo=[10.192.38.97]) by fbsd.ru with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1c99Ep-0008pd-7D for freebsd-arm@freebsd.org; Tue, 22 Nov 2016 14:27:47 +0300 User-Agent: Microsoft-MacOutlook/f.1c.1.161117 Date: Tue, 22 Nov 2016 14:27:46 +0300 Subject: OrangePI plus2e on AllWinner H3 - first success From: "Vladimir B. Grebenschikov" To: Message-ID: Thread-Topic: OrangePI plus2e on AllWinner H3 - first success Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable 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: Tue, 22 Nov 2016 11:27:52 -0000 Hi=20 I am try to get FreeBSD run on OrangePI plus2e - http://www.orangepi.org/or= angepiplus2e/ It is ALLWINNER H3 SoC, and from first glance it should work, Linux boots o= k on the chip (although wired ethernet does not work) As far as I found not much information about running FreeBSD on the board, = some short explanation what I did and what happened below. 1. Build flash (combining instructions from https://wiki.freebsd.org/FreeBS= D/arm/Cubieboard and from https://wiki.freebsd.org/FreeBSD/arm/Allwinner) and write it on SD-card (only installworld and distribution) 2. Adopt u-boot port to use orangepi-plus2e config (see below), and write i= t on SD-card also (as in port README), https://bugs.freebsd.org/bugzilla/sho= w_bug.cgi?id=3D214729 3. Connect serial console (do not forgot about TTL levels on board),=20 now it starts, shows right amount of memory and found hardware: U-Boot SPL 2016.09 (Nov 22 2016 - 01:00:45) DRAM: 2048 MiB Trying to boot from MMC1 U-Boot 2016.09 (Nov 22 2016 - 01:00:45 +0300) Allwinner Technology ------------- CPU: Allwinner H3 (SUN8I 1680) Model: Xunlong Orange Pi Plus 2E I2C: ready DRAM: 2 GiB WARNING: Caches not enabled MMC: SUNXI SD/MMC: 0, SUNXI SD/MMC: 1 reading u-boot.env ** Unable to read "u-boot.env" from mmc0:1 ** Using default environment In: serial Out: serial Err: serial Net: phy interface7 eth0: ethernet@1c30000 starting USB... USB0: USB EHCI 1.00 USB1: USB OHCI 1.0 USB2: USB EHCI 1.00 USB3: USB OHCI 1.0 USB4: USB EHCI 1.00 USB5: USB OHCI 1.0 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 4 for devices... 1 USB Device(s) found Hit any key to stop autoboot: 0 Booting from: mmc 0 ubldr.bin reading ubldr.bin ** Unable to read file ubldr.bin ** =3D> ------------- Warning about cache a bit surprises me 4. Load kernel as in instruction (it was written on FAT partition of SD car= d) =3D> fatload mmc 0 0x40200000 kernel reading kernel 8336460 bytes read in 1110 ms (7.2 MiB/s) =3D> so far everything looks ok =E2=80=A6 5. Now try to start FreeBSD kernel =E2=80=93 with no luck: =3D> go 0x40200000 ## Starting application at 0x40200000 ... =E2=80=A6. Nothing, LEDs on board are still off =E2=80=A6 6. Ok, let=E2=80=99s try to put whole /boot on FAT partition =E2=80=93 much better =E2=80=A6 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 4 for devices... 1 USB Device(s) found Hit any key to stop autoboot: 0 Booting from: mmc 0 ubldr.bin reading ubldr.bin 225100 bytes read in 77 ms (2.8 MiB/s) ## No elf image at address 0x42000000 ## Starting application at 0x42000000 ... Consoles: U-Boot console Compatible U-Boot API signature found @0xbbf426d0 FreeBSD/armv6 U-Boot loader, Revision 1.2 (root@srv.fbsd.ru, Mon Nov 21 14:59:11 MSK 2016) DRAM: 2048MB MMC Device 2 not found Number of U-Boot devices: 2 U-Boot env: loaderdev=3D'mmc 0' Found U-Boot device: disk Checking unit=3D0 slice=3D partition=3D... good. Booting from disk0s2a: /boot/kernel/kernel data=3D0x6708e4+0x1a771c syms=3D[0x4+0x90cd0+0x4+0xa6cd8] Hit [Enter] to boot immediately, or any other key for command prompt. Booting [/boot/kernel/kernel]... No valid device tree blob found! Type '?' for a list of commands, 'help' for more detailed help. loader> aha=E2=80=A6 dtb: loader> load -t dtb boot/dtb/orangepi-plus-2e.dtb boot/dtb/orangepi-plus-2e.dtb size=3D0x51ac 7. Now try to boot: loader> boot sing DTB from loaded file 'boot/dtb/orangepi-plus-2e.dtb'. Kernel entry at 0x42200100... Kernel args: (null) KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #0 90a2ed0(master): Mon Nov 21 12:29:40 MSK 2016 root@srv.fbsd.ru:/usr/obj/arm.armv6/usr/src2/sys/ALLWINNER arm FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM = 3.8.0) WARNING: WITNESS option enabled, expect reduced performance. VT: init without driver. CPU: ARM Cortex-A7 r0p5 (ECO: 0x00000000) CPU Features: Multiprocessing, Thumb2, Security, Virtualization, Generic Timer, VMSAv7, PXN, LPAE, Coherent Walk Optional instructions: SDIV/UDIV, UMULL, SMULL, SIMD(ext) LoUU:2 LoC:3 LoUIS:2 Cache level 1: 32KB/64B 4-way data cache WB Read-Alloc Write-Alloc 32KB/32B 2-way instruction cache Read-Alloc Cache level 2: 512KB/64B 8-way unified cache WB Read-Alloc Write-Alloc real memory =3D 2147483648 (2048 MB) avail memory =3D 2087354368 (1990 MB) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs random: entropy device external interface kbd0 at kbdmux0 ofwbus0: aw_ccu0: on ofwbus0 clk_fixed0: on aw_ccu0 clk_fixed1: on aw_ccu0 aw_pll0: mem 0x1c20000-0x1c20003 on aw_ccu0 clk_fixed2: on aw_ccu0 aw_pll1: mem 0x1c20028-0x1c2002b on aw_ccu0 clk_fixed3: on aw_ccu0 clk_fixed4: on aw_ccu0 aw_cpuclk0: mem 0x1c20050-0x1c20053 on aw_ccu0 aw_axiclk0: mem 0x1c20050-0x1c20053 on aw_ccu0 aw_ahbclk0: mem 0x1c20054-0x1c20057 on aw_ccu0 aw_ahbclk1: mem 0x1c2005c-0x1c2005f on aw_ccu0 aw_apbclk0: mem 0x1c20054-0x1c20057 on aw_ccu0 aw_apbclk1: mem 0x1c20058-0x1c2005b on aw_ccu0 aw_gate0: mem 0x1c20060-0x1c20073 on aw_ccu0 aw_mmcclk0: mem 0x1c20088-0x1c2008b on aw_ccu0 aw_mmcclk1: mem 0x1c2008c-0x1c2008f on aw_ccu0 aw_mmcclk2: mem 0x1c20090-0x1c20093 on aw_ccu0 aw_usbclk0: mem 0x1c200cc-0x1c200cf on aw_ccu0 clk_fixed5: on aw_ccu0 aw_gate1: mem 0x1f01428-0x1f0142b on aw_ccu0 aw_modclk0: mem 0x1f01454-0x1f01457 on aw_ccu0 aw_pll2: mem 0x1c20008-0x1c2000b on aw_ccu0 aw_thsclk0: mem 0x1c20074-0x1c20077 on aw_ccu0 aw_codecclk0: mem 0x1c20140-0x1c20143 on aw_ccu0 simplebus0: on ofwbus0 aw_reset0: mem 0x1c202c0-0x1c202cb on simplebus0 aw_reset1: mem 0x1c202d0-0x1c202d3 on simplebus0 aw_reset2: mem 0x1c202d8-0x1c202db on simplebus0 aw_reset3: mem 0x1f014b0-0x1f014b3 on simplebus0 iichb0: mem 0x1c2ac00-0x1c2afff i= rq 29 on simplebus0 iicbus0: on iichb0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 regfix0: on ofwbus0 regfix1: on ofwbus0 regfix2: on ofwbus0 regfix3: on ofwbus0 regfix4: on ofwbus0 regfix5: on ofwbus0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 aw_sid0: mem 0x1c14000-0x1c143ff on simple= bus0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 awusbphy0: mem 0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,= 0x1c1b800-0x1c1b803,0x1c1c800-0x1c1c803,0x1c1d800-0x1c1d803 on simplebus0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 gic0: mem 0x1c81000-0x1c81fff,0x1c82000-= 0x1c82fff,0x1c84000-0x1c85fff,0x1c86000-0x1c87fff irq 23 on simplebus0 gic0: pn 0x10, arch 0x2, rev 0x1, implementer 0x43b irqs 160 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 gpio0: mem 0x1c20800-0x1c20bff irq 14,15= on simplebus0 gpiobus0: on gpio0 gpio1: mem 0x1f02c00-0x1f02fff irq 27 on= simplebus0 gpiobus1: on gpio1 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 generic_timer0: irq 0,1,2,3 on ofwbus0 Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000 Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000 rtc0: mem 0x1f00000-0x1f00053 irq 24,25 on simplebus0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 cpulist0: on ofwbus0 cpu0: on cpulist0 cpufreq_dt0: on cpu0 cpufreq_dt0: no regulator for cpu@0 device_attach: cpufreq_dt0 attach returned 6 cpu1: on cpulist0 cpu2: on cpulist0 cpu3: on cpulist0 a31dmac0: mem 0x1c02000-0x1c02fff irq 4 on simpl= ebus0 a10_mmc0: mem 0x1c0f000-0x1c0ffff = irq 5 on simplebus0 mmc0: on a10_mmc0 a10_mmc1: mem 0x1c10000-0x1c10fff = irq 6 on simplebus0 mmc1: on a10_mmc1 a10_mmc2: mem 0x1c11000-0x1c11fff = irq 7 on simplebus0 mmc2: on a10_mmc2 ehci0: mem 0x1c1b000-0x1c1b0ff ir= q 8 on simplebus0 usbus0: EHCI version 1.0 usbus0 on ehci0 ehci1: mem 0x1c1c000-0x1c1c0ff ir= q 10 on simplebus0 usbus1: EHCI version 1.0 usbus1 on ehci1 ehci2: mem 0x1c1d000-0x1c1d0ff ir= q 12 on simplebus0 usbus2: EHCI version 1.0 usbus2 on ehci2 gpioc0: on gpio0 aw_wdog0: mem 0x1c20ca0-0x1c20cbf irq 18 on simple= bus0 =EF=BF=BD=EF=BF=BDuart0: mem 0x1c28000-0x1c= 283ff irq 19 on simplebus0 uart0: console (961538,n,8,1) gpioc1: on gpio1 awg0: mem 0x1c30000-0x1c30103,0x1c00030-0x1c00= 033 irq 28 on simplebus0 miibus0: on awg0 rgephy0: PHY 0 on miibus0 rgephy0: none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseT= X-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000b= aseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-f= low rgephy1: PHY 1 on miibus0 rgephy1: none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseT= X-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000b= aseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-f= low awg0: Ethernet address: 02:20:36:eb:80:da iic0: on iicbus0 iichb1: mem 0x1f02400-0x1f027ff i= rq 32 on simplebus0 iichb1: could not find clock device_attach: iichb1 attach returned 2 aw_thermal0: mem 0x1c25000-0x1c253ff = irq 33 on simplebus0 pcm0: mem 0x1c22c00-0x1c22cff,0x1f015c0-0x1f015c3 i= rq 34 on simplebus0 gpioled0: on ofwbus0 cryptosoft0: Timecounters tick every 1.000 msec usbus0: 480Mbps High Speed USB v2.0 usbus1: 480Mbps High Speed USB v2.0 usbus2: 480Mbps High Speed USB v2.0 ugen0.1: at usbus0 uhub0: on usbus= 0 ugen1.1: at usbus1 uhub1: on usbus= 1 ugen2.1: at usbus2 uhub2: on usbus= 2 mmcsd0: 8GB at mmc0 50.0MH= z/4bit/65535-block a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 a10_mmc1: error rint: 0x00000100 mmc1: No compatible cards found on bus a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00008018 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 a10_mmc2: error rint: 0x00000100 mmcsd1: 16GB at mmc= 2 52.0MHz/8bit/65535-block Release APs WARNING: WITNESS option enabled, expect reduced performance. Root mount waiting for: usbus2 usbus1 usbus0 uhub0: 1 port with 1 removable, self powered uhub2: 1 port with 1 removable, self powered uhub1: 1 port with 1 removable, self powered Loader variables: Manual root filesystem specification: : [options] Mount using filesystem and with the specified (optional) option list. eg. ufs:/dev/da0s1a zfs:tank cd9660:/dev/cd0 ro (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) ? List valid disk boot devices . Yield 1 second (for background tasks) Abort manual input mountroot> ufs:/dev/mmcsd0s2a Trying to mount root from ufs:/dev/mmcsd0s2a []... /etc/rc: WARNING: hostid: unable to figure out a UUID from DMI data, genera= ting a new one Setting hostuuid: 163024e2-f669-11de-a77e-230d85878639. Setting hostid: 0x914f0eb3. eval: cannot open /etc/fstab: No such file or directory No suitable dump device was found. eval: cannot open /etc/fstab: No such file or directory fstab: /etc/fstab:0: No such file or directory Warning! No /etc/fstab: skipping disk checks. fstab: /etc/fstab:0: No such file or directory Mounting local filesystems:fstab: /etc/fstab:0: No such file or directory . ELF ldconfig path: /lib /usr/lib /usr/lib/compat random: unblocking device. Soft Float compatibility ldconfig path: /etc/rc: WARNING: $hostname is not set -- see rc.conf(5). Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_= TUN,MOUSE,KEYBOARD,ATTACH,CACHED Feeding entropy: . Starting Network: lo0 awg0. lo0: flags=3D8049 metric 0 mtu 16384 options=3D600003 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=3D21 awg0: flags=3D8802 metric 0 mtu 1500 options=3D8000b ether 02:20:36:eb:80:da media: Ethernet autoselect (none) nd6 options=3D29 Starting devd. Starting Network: awg0. awg0: flags=3D8802 metric 0 mtu 1500 options=3D8000b ether 02:20:36:eb:80:da media: Ethernet autoselect (none) nd6 options=3D29 add host 127.0.0.1: gateway lo0 fib 0: route already in table add host ::1: gateway lo0 fib 0: route already in table add net fe80::: gateway ::1 add net ff02::: gateway ::1 add net ::ffff:0.0.0.0: gateway ::1 add net ::0.0.0.0: gateway ::1 Generating host.conf. fstab: /etc/fstab:0: No such file or directory fstab: /etc/fstab:0: No such file or directory Creating and/or trimming log files. Starting syslogd. Clearing /tmp (X related). Updating motd:. Mounting late filesystems:fstab: /etc/fstab:0: No such file or directory . fstab: /etc/fstab:0: No such file or directory ^CScript /etc/rc.d/sendmail interrupted Starting cron. eval: cannot open /etc/fstab: No such file or directory Starting background file system checks in 60 seconds. Fri Jan 1 00:03:54 UTC 2010 FreeBSD/arm (Amnesiac) (ttyu0) login: Finally, it boots,=20 ethernet adapter looks working ok: media: Ethernet autoselect (1000b= aseT ) wifi was not auto-detected on boot (Realtek RTL8189ETV, IEEE 802.11 b/g/n) even SMP looks works as expected: last pid: 743; load averages: 1.03, 0.42, 0.36 up 0+00:16:12 00:1= 6:34 13 processes: 5 running, 8 sleeping CPU: 100% user, 0.0% nice, 0.0% system, 0.0% interrupt, 0.0% idle Mem: 10M Active, 1380K Inact, 49M Wired, 13M Buf, 1936M Free Swap: PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMA= ND 738 root 1 98 0 6696K 2840K CPU1 1 0:19 103.05% sh 737 root 1 99 0 6696K 2812K CPU3 3 0:21 101.11% sh 741 root 1 92 0 6696K 2840K RUN 2 0:11 99.44% sh 740 root 1 93 0 6696K 2840K CPU0 0 0:12 96.06% sh 743 root 1 20 0 7616K 2972K CPU2 2 0:00 0.57% top =E2=80=A6 =20 How to make orangepi-plus2e specific port: $ diff -u u-boot-orangepi-one/Makefile u-boot-orangepi-plus2e/Makefile --- u-boot-orangepi-one/Makefile 2016-07-12 23:22:16.000000000 +0300 +++ u-boot-orangepi-plus2e/Makefile 2016-11-22 01:00:30.715760000 +0300 @@ -8,7 +8,7 @@ MASTERDIR=3D ${.CURDIR}/../u-boot-olimex-a20-som-evb DESCR=3D ${.CURDIR}/pkg-descr -MODEL=3D orangepi-one -BOARD_CONFIG=3D orangepi_one_defconfig +MODEL=3D orangepi-plus2e +BOARD_CONFIG=3D orangepi_plus2e_defconfig .include "${MASTERDIR}/Makefile" Some very basic patch on crochet tool: https://github.com/freebsd/crochet/p= ull/168 -- Vladimir B. Grebenschikov vova@fbsd.ru