From owner-freebsd-arm@FreeBSD.ORG Tue Jan 1 01:00:36 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DCDE621 for ; Tue, 1 Jan 2013 01:00:36 +0000 (UTC) (envelope-from aoyama@peach.ne.jp) Received: from moon.peach.ne.jp (moon.peach.ne.jp [203.141.148.98]) by mx1.freebsd.org (Postfix) with ESMTP id 7476B8FC0C for ; Tue, 1 Jan 2013 01:00:35 +0000 (UTC) Received: from moon.peach.ne.jp (localhost [127.0.0.1]) by moon.peach.ne.jp (Postfix) with ESMTP id D02DF3AC92 for ; Tue, 1 Jan 2013 10:00:27 +0900 (JST) Received: from artemis (unknown [172.18.0.20]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by moon.peach.ne.jp (Postfix) with ESMTPSA id B534439FA3 for ; Tue, 1 Jan 2013 10:00:27 +0900 (JST) Message-ID: From: "Daisuke Aoyama" To: References: In-Reply-To: Subject: Re: FreeBSD/armv6z/clang on Raspberry Pi 512MB (with U-Boot + ubldr) Date: Tue, 1 Jan 2013 10:00:22 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 14.0.8117.416 X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8117.416 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jan 2013 01:00:36 -0000 Happy New Year! I have updated clang RPI code based on SVN r244906. major change is: o always use unaligned for clang (see http://lists.freebsd.org/pipermail/freebsd-arm/2012-December/004464.html) o remove NO_INLINE from kernel config, add MSDOSFS since test10 o drop invalidate I-Cache, add flush BTB instead o increase MIN_PERIOD to 200 for down clock mode stability o workaround for broken stupid dev/mmc (should be rewritten) o control HS mode in bcm2853_sdhci, replace bus_space handle o add hw.bcm2835.sdhci.hs MIB (disabled by default) o add isb/dsb/dmb and mb/rmb/wmb macro in atomic.h o add bs_barrier, bs_vaddr operation o hand optimaized asm routine(bcm2835_asm.S) for tc_get_timecount and SD card transfer Above changes make over 80% faster than previous kernel by ports/benchmarks/unixbench. Before: ---------------------------------------------------------------------------------------- Execl Throughput 43.0 83.3 19.4 File Copy 1024 bufsize 2000 maxblocks 3960.0 1464.0 3.7 File Copy 256 bufsize 500 maxblocks 1655.0 1563.0 9.4 File Copy 4096 bufsize 8000 maxblocks 5800.0 1405.0 2.4 Pipe Throughput 12440.0 79059.7 63.6 Pipe-based Context Switching 4000.0 6815.1 17.0 Process Creation 126.0 242.2 19.2 Shell Scripts (8 concurrent) 6.0 27.9 46.5 ---------------------------------------------------------------------------------------- After (depend on your SD card spec, of course): ---------------------------------------------------------------------------------------- Execl Throughput 43.0 89.8 20.9 (1.1x) File Copy 1024 bufsize 2000 maxblocks 3960.0 2622.0 6.6 (1.8x) File Copy 256 bufsize 500 maxblocks 1655.0 1595.0 9.6 (1.0x) File Copy 4096 bufsize 8000 maxblocks 5800.0 7287.0 12.6 (5.1x) Pipe Throughput 12440.0 101503.0 81.6 (1.3x) Pipe-based Context Switching 4000.0 10609.1 26.5 (1.6x) Process Creation 126.0 274.7 21.8 (1.1x) Shell Scripts (8 concurrent) 6.0 27.9 46.5 (1.0x) ---------------------------------------------------------------------------------------- Also, SD card should be set to 25MHz and 4bit respectively. (DS mode, 100Mbps = 12.5MB/s) ---------------------------------------------------------------------------------------- root@raspberry-pi:~ # dd if=/dev/mmcsd0 of=/dev/null bs=1m count=32 32+0 records in 32+0 records out 33554432 bytes transferred in 3.231259 secs (10384322 bytes/sec) ---------------------------------------------------------------------------------------- You can get the pre-build image from my archives: http://www.peach.ne.jp/archives/rpi/ (At this time, freebsd-pi-clang-20130101.img.gz is the latest version.) Download and decompress it, then write it to SD. This image requires SD 4GB or more. I'm using as headless server. So, you need a serial console for seeing full boot log. If you want the video out, please remove the line of "setconsole=comconsole" in /boot/loader.rc. If you need to change the value on it, please mount the second partition (e.g. /dev/da0s2a). This version includes complete source tree of r244906. But the patch is not applied. You must apply the patch manually. Note: first time, it takes about 2 minutes for generating the SSH keys. Using config is here: http://www.peach.ne.jp/archives/rpi/config/RPI-B-test11 New kernel only is here: http://www.peach.ne.jp/archives/rpi/kernel/ Source and pacth is here: http://www.peach.ne.jp/archives/rpi/patch/ For more, please read this: http://lists.freebsd.org/pipermail/freebsd-arm/2012-December/004421.html http://lists.freebsd.org/pipermail/freebsd-arm/2012-December/004331.html http://shell.peach.ne.jp/aoyama/ ---------------------------------------------------------------------- Pre-configured for: MEM 496MB/GPU 16MB/SWAP 512MB I/O: multi-console (primary serial) IP address: 192.168.1.240 Default router: 192.168.1.1 DNS: 192.168.1.1 sshd: enabled ntpdate: enabled (0.freebsd.pool.ntp.org) User: pi Password: raspberry Password(root): raspberry ---------------------------------------------------------------------- First, you may need to edit pre-configured files: /boot/loader.rc /etc/fstab /etc/rc.conf /etc/hosts /etc/resolv.conf /etc/master.passwd /etc/group ---------------------------------------------------------------------- example /etc/make.conf: ---------------------------------------------------------------------- WITHOUT_X11=yes WITH_CLANG=yes WITH_CLANG_IS_CC=yes # For clang NO_WERROR= WERROR= CFLAGS=-O2 -fno-strict-aliasing -pipe -march=armv6z -mtune=arm1176jzf-s -mfloat-abi=soft COPTFLAGS=-O1 -fno-strict-aliasing -pipe -march=armv6z -mtune=arm1176jzf-s -mfloat-abi=soft ---------------------------------------------------------------------- How to build the kernel in RPI: # fetch -o /usr http://www.peach.ne.jp/archives/rpi/patch/src-244906-20130101.patch.gz # fetch -o /usr/src/sys/arm/conf http://www.peach.ne.jp/archives/rpi/config/RPI-B-test11 # cd /usr/src # gzcat /usr/src-244906-20130101.patch.gz | patch # make buildkernel KERNCONF=RPI-B-test11 WITH_FDT=yes (wait about 50 minutes) Don't forget to add NO_WERROR= and WERROR= to /etc/make.conf if you use clang. If you already applied previous patch, you can remove it by like this: # cd /usr/src # gzcat /usr/src-XXXXXX-YYYYMMDD.patch.gz | patch -R If you want re-compile without cleaning, you can try to use like this: # make buildkernel KERNCONF=RPI-B-test11 WITH_FDT=yes -DNO_CLEAN -DNO_CLEANDIR ---------------------------------------------------------------------- How to use GPT USB stick in RPI: (if you use something, delete/destory it before doing) # gpart show # gpart delete -i N da0 (where N is number of a partition) # gpart destroy -F da0 (create new partition and format) # gpart create -s gpt da0 # gpart add -t freebsd-ufs da0 # gpart show # newfs -U -j /dev/da0p1 (mount it) # mount /dev/da0p1 /mnt ---------------------------------------------------------------------- How to mount boot partition (MSDOS partition): # mount -t msdosfs /dev/mmcsd0s1 /mnt After this, you can edit the files such as config.txt in the boot partition. ---------------------------------------------------------------------- Enjoy clang world in Raspberry Pi! Thank you. -- Daisuke Aoyama