From owner-freebsd-arm@FreeBSD.ORG Tue Jan 3 01:04:53 2012 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 B6A451065670 for ; Tue, 3 Jan 2012 01:04:53 +0000 (UTC) (envelope-from adutkowski@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 83E2D8FC0A for ; Tue, 3 Jan 2012 01:04:53 +0000 (UTC) Received: by iadj38 with SMTP id j38so37789622iad.13 for ; Mon, 02 Jan 2012 17:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=I45F8iOJEAogsfcb4Ej+AYn7dCfBylQPkkJNF7iSciM=; b=p3Jds49/DCO4yQxtvDl25eri6tki2VnyQxada+OG7S8bxY7/xpbofyibJ509ROImR1 xwy/kA9lbaHpjHkK5xujQt+xN7XwcAX4Gv0ZZzlai/EIqVKDN+YI2rHDZZ6poRffCmTA 5p1Pnx9Zre2hMT2eydjVXWNiV+r5K8Dp96C9o= MIME-Version: 1.0 Received: by 10.50.170.35 with SMTP id aj3mr60593822igc.2.1325551044871; Mon, 02 Jan 2012 16:37:24 -0800 (PST) Received: by 10.50.89.165 with HTTP; Mon, 2 Jan 2012 16:37:24 -0800 (PST) Date: Tue, 3 Jan 2012 01:37:24 +0100 Message-ID: From: Aleksander Dutkowski To: freebsd-arm@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: porting freebsd to at91sam9g45 ( SBC6045 board) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 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, 03 Jan 2012 01:04:53 -0000 hi! Ive just come from linux world to FreeBSD and I have SBC6045 board based on at91sam9g45 SoC so Ive decided to try and port FBSD on it ;) I have quite good knowledge in x86 processor internals like paging, protected mode etc, but I haven't been programing low level on arm arch yet. Somebody created port for SAM9G20EK, so I tried to compile and run it: cd /usr/arm // my own copy from svn export TARGET=arm export TARGET_ARCH=arm export MAKEOBJDIRPREFIX=/usr/arm/obj make buildkernel KERNCONF=SAM9G20EK make installkernel KERNCONF=SAM9G20EK DESTDIR=/arm-kernel INSTALL_NODEBUG=t file /arm-kernel/boot/kernel/kernel kernel: ELF 32-bit LSB executable, ARM, version 1 (FreeBSD), dynamically linked (uses shared libs), not stripped And this is output from board's debug console: ---------------------------------------------------------------------------------------------- Start AT91Bootstrap... U-Boot 1.3.4 (May 15 2011 - 11:23:14) DRAM: 256 MB ## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 kB NAND: 256 MiB Error: 8 bit/pixel mode, but BMP has 32 bit/pixel In: serial Out: serial Err: serial Net: macb0 Hit any key to stop autoboot: 0 U-Boot> tftp 0x20000000 fbsd macb0: Starting autonegotiation... macb0: Autonegotiation complete macb0: link up, 100Mbps full-duplex (lpa: 0x4de1) Using macb0 device TFTP from server 192.168.3.1; our IP address is 192.168.3.2 Filename 'fbsd'. Load address: 0x20000000 Loading: ################################################################# ################################################################# ################################################################# ############################################################### done Bytes transferred = 3775383 (399b97 hex) U-Boot> go 0x200000C0 ## Starting application at 0x200000C0 ... ---------------------------------------------------------------------------------------------- and it hangs - I can see that very early Where did I get address 0x200000C0? # readelf kernel -S | grep .text [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 1] .text PROGBITS c00000c0 0000c0 239e30 00 AX 0 0 32 # readelf kernel -s | grep _start [...] 461: c00000c0 0 FUNC GLOBAL DEFAULT 1 _start [...] # cat /sys/arm/at91/std.sam9g20ek makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 options KERNVIRTADDR=0xc0000000 so, based on http://wiki.freebsd.org/FreeBSDAtmel, Ive changed 0x200000E0 to 0x200000C0 Ive put all of this code because maybe you'll find some mistakes. But I am now researching info and can't tell how fbsd should be booted. I have seen some code made by mr Rafal Jaworowski where he ran loader(8) from u-boot and then kernel. Is this proper way today to boot fbsd on arm? Because Ive researched, that my kernel file is only a plain kernel, no boot0, boot2, nor loader. But maybe executing loader will be easier? -- regards Aleksander Dutkowski