Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
freebsdavila [2008/03/16 05:16] – WarnerLoshfreebsdavila [2020/12/11 00:30] (current) – JohnMarkGurney
Line 1: Line 1:
 ====== FreeBSD/arm for Gateworks Avila board ====== ====== FreeBSD/arm for Gateworks Avila board ======
  
-This procedure has been tested on a %%FreeBSD%% HEAD system.+<callout type="warning"> 
 +**No longer supported** 
 + 
 +Support for these boards have been removed.  The last branch to support it is stable/11, but may need to go to previous stable branches for functional support.  stable/9 is known to work. 
 +</callout> 
 + 
 +===== Building and Booting Diskless =====
  
 ==== Build world ==== ==== Build world ====
  
 <code> <code>
-make TARGET_ARCH=arm TARGET_CPUTYPE=xscale TARGET_BIG_ENDIAN=true buildworld +make TARGET_ARCH=armeb TARGET_CPUTYPE=xscale buildworld 
 </code> </code>
  
-==== Setup an NFS root ====+==== Setup an new NFS root ====
  
 <code> <code>
 ROOT=/data/freebsd/roots/gateworks ROOT=/data/freebsd/roots/gateworks
-make TARGET_ARCH=arm TARGET_CPUTYPE=xscale TARGET_BIG_ENDIAN=true \ +make TARGET=arm TARGET_CPUTYPE=xscale TARGET_ARCH=armeb DESTDIR=$ROOT installworld 
-DESTDIR=$ROOT installworld +make TARGET=arm TARGET_CPUTYPE=xscale TARGET_ARCH=armeb DESTDIR=$ROOT distribution 
-mergemaster -m $SRC/etc -D $ROOT -i -A arm +mergemaster -m $SRC/etc -D $ROOT -i -A arm
 </code> </code>
  
 Note: mergemaster will fail if used to install HEAD on a RELENG_6 system unless /usr/share/mk on the host system has been updated w/ changes to the build infrastructure. Note: mergemaster will fail if used to install HEAD on a RELENG_6 system unless /usr/share/mk on the host system has been updated w/ changes to the build infrastructure.
 +Note: This will still fail to produce an NFS root image that can be logged in as root via control.  You can add proper ssh keys and enable sshd in rc.conf and enable root logins via sshd_config to login.
 ==== Configure the NFS root for diskless use ==== ==== Configure the NFS root for diskless use ====
 Consult diskless(8). Consult diskless(8).
 ==== Build and install a kernel ==== ==== Build and install a kernel ====
-  * Load the npe(4) microcode file IxNpeMicrocode.dat from http://www.intel.com/design/network/products/npfamily/ixp400_current.htm and put it into /sys/arm/xscale/ixp425/  
  
 <code> <code>
-make TARGET_ARCH=arm KERNCONF=AVILA buildkernel +make TARGET=arm TARGET_ARCH=armeb KERNCONF=AVILA buildkernel 
-make TARGET_ARCH=arm KERNCONF=AVILA DESTDIR=$ROOT installkernel  +make TARGET=arm TARGET_ARCH=armeb KERNCONF=AVILA DESTDIR=$ROOT installkernel  
 </code> </code>
  
Line 68: Line 74:
 ==== Record the above commands ==== ==== Record the above commands ====
  
-To record the above redboot script so that it's used every time the board is reset run the fconfig command at the redboot prompt and answer the questions.  Past this you can setup a %%FreeBSD%% installation on compact flash and store a kernel in flash using redboot.  Then on boot load the kernel from flash and if that kernel is configured with root on ad0 you can run entirely from local storage.  Note that the redboot that comes in the Avila board does not understand how to load a file from UFS +To record the above redboot script so that it's used every time the board is reset run the fconfig command at the redboot prompt and answer the questions.
-so it is not yet possible to boot a kernel directly from compact flash (when formatted with UFS).+
  
-==== Boot kernel from CF ==== +===== Building with Nanobsd =====
-On Avila:+
  
-  * Insert CF into the board. +The nanobsd(8) packaging system can be used to construct bootable compact flash images.  This can even be done on a little-endian x86 system using makefs(8)  To build an image for Avila boards use these steps:
-  * Boot from NFS +
-  * fdisk ad0 +
-  * disklabel ad0s1 (remember that xscale-arm kernel is big-endian) +
-  * mount /dev/ad0s1a /mnt +
-  * cd /; find -x . | cpio -pdamuv /mnt +
  
-On the NFS Host:+Run nanobsd.  There is an example packaging configuration for Avila boards in tools/tools/nanobsd/gateworks:
  
-  * Adapt /sys/arm/conf/AVILA, comment out options NFS_ROOT, BOOTP* +<code> 
-  * add option ROOTDEVNAME=\"ufs:ad0s1\" +cd tools/tools/nanobsd/gateworks 
-  * make kernel like above. +sh ../nanobsd.sh -c ./avila 
-  * install kernel into tftpd area as kernel.ad0+</code> 
 + 
 +Note this will cross-compile world and a kernel then construct the disk image.  If you are not running as root this will fail after building world and kernel.  To resume the operation as the super user you can just use the -b option; e.g. 
 + 
 +<code> 
 +sudo ../nanobsd.sh -b -c ./config 
 +</code> 
 + 
 +The file avila specifies the contents of the file system image and how to construct the disk image.  This will likely need changing to suit local filesystem setup.  The kernel configuration is located in the same directory and is named G2348.  This too may be edited or replaced with an alternative configuration. 
 + 
 +Nanobsd leaves the disk image in the /usr/obj/nanobsd.avila directory. You will need to transfer this data to a compact flash part.  If you have a compact flash reader/writer on a %%FreeBSD%% machine then this is done with dd; e.g. 
 + 
 +<code> 
 +dd if=_.disk.full of=/dev/da0 bs=32b 
 +</code> 
 + 
 +The block size is important; if the transfer size does not reflect the expected geometry then the image written will/may be corrupted.  The block size used to construct the image is noted in comments at the bottom of the nanobsd log file named _.di. 
 + 
 +To update a nanobsd image you can use command line options for the script.  For example if you want to rebuild the kernel and update the image you might use: 
 + 
 +<code> 
 +sudo ../nanobsd.sh -w -n -c ./config 
 +</code> 
 + 
 +This will skip the buildworld stage then do a buildkernel with the -DNO_CLEAN option to reuse a previous build.  If you want to update the image but not build anything (e.g. you have changed the custom steps used to construct the flash image) use: 
 + 
 +<code> 
 +sudo ../nanobsd.sh -b -c ./config 
 +</code> 
 + 
 +NOTE: At this time nanobsd does not know how to cross-build ports; the only way to add programs from the ports is to nfs mount a ports tree on a running Avila system and then build the programs.  The results can be saved and copied to the compact flash image with nanobsd or installed directly on the running system (possibly after re-mounting the filesystem(s) read/write). 
 + 
 +===== Boot kernel from CF ===== 
 + 
 +Past this you can setup a %%FreeBSD%% installation on compact flash and use %%RedBoot%% to load a second level bootstrap from the onboard flash that loads %%FreeBSD%% from compact flash.  The running sytem then uses a file system written to compact flash.  Note that this two-stage boot process is necessary because %%RedBoot%% does not understand how to load a file from a Unix File System (UFS)--the standard filesystem used by %%FreeBSD%%. 
 + 
 +==== On the build machine: ==== 
 + 
 +Build a kernel configured to mount the file system from ad0. This is most easily done by copying the AVILA config file and stripping out the BOOTP* options. 
 + 
 +Build the second level bootstrap program by entering the arm/xscale build environment and building sys/boot2/ixdp425: 
 + 
 +<code> 
 +make TARGET_ARCH=arm TARGET_CPUTYPE=xscale TARGET_ARCH=armeb buildenv 
 +cd sys/boot/arm/ixp425/boot2/ 
 +make 
 +</code> 
 + 
 +Note that boot2 can be built to expect a BSD disklabel in the disk partition or not.  The default build does not enable this    because the bsdlabel program usually used to image disk labels is not endian-agonostic so is not usable on a little-endian   machine to construct a filesystem for a big-endian ixp425 system. If you want to change how boot2 is built edit the Makefile or override the flags from the command line. 
 + 
 +Once boot is built copy it to where tftp loads files from; e.g. 
 + 
 +<code> 
 +cp boot2 /data/tftpboot/boot2.avila 
 +</code> 
 + 
 +==== On the target board ==== 
 + 
 +Download the boot2.avila file and write it to an image in the onboard flash (NB: we named the flash image boot2.freebsd 
 +as opposed to the boot2.avila filename on the tftp server): 
 + 
 +<code> 
 +RedBoot> load boot2.avila 
 +Using default protocol (TFTP) 
 +Entry point: 0x00180000, address range: 0x00180000-0x00183384 
 +RedBoot> fis create boot2.freebsd 
 +... Erase from 0x50080000-0x500a0000: . 
 +... Program from 0x00180000-0x00183384 at 0x50080000: . 
 +... Unlock from 0x50fe0000-0x51000000: . 
 +... Erase from 0x50fe0000-0x51000000: . 
 +... Program from 0x03fe0000-0x04000000 at 0x50fe0000: . 
 +... Lock from 0x50fe0000-0x51000000: . 
 +RedBoot> fis list 
 +Name              FLASH addr  Mem addr    Length      Entry point 
 +RedBoot           0x50000000  0x50000000  0x00080000  0x00000000 
 +boot2.freebsd     0x50080000  0x00180000  0x00020000  0x00180000 
 +FIS directory     0x50FE0000  0x50FE0000  0x0001F000  0x00000000 
 +RedBoot config    0x50FFF000  0x50FFF000  0x00001000  0x00000000 
 +</code> 
 + 
 +You are now ready to boot from compact flash.  If you want to test operation you can do this manually: 
 + 
 +<code> 
 +RedBoot> fis load boot2.freebsd 
 +RedBoot> go 
 +FreeBSD ARM (Avila) boot2 v0.2 
 +- 
 +Default: /boot/kernel/kernel 
 +boot: 
 +KDB: debugger backends: ddb 
 +KDB: current backend: ddb 
 +Copyright (c) 1992-2008 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 7.1-PRERELEASE #1: Fri Sep 26 14:37:41 PDT 2008 
 +            root@trouble.errno.com:/usr/obj/nanobsd.avila/arm/usr/sam/vap_releng7/sys/G2348 
 +... 
 +</code> 
 + 
 +To set the default boot to happen from compact flash just change the %%RedBoot%% configuration to do the above steps automatically; e.g. 
 + 
 +<code> 
 +RedBoot> fconfig 
 +Run script at boot: true 
 +Boot script: 
 +.. load -b 0x200000 kernel-avila.nfs.vap7 
 +.. go 
 +Enter script, terminate with empty line 
 +>> fis load boot2.freebsd 
 +>> go 
 +>> 
 +Boot script timeout (100ms resolution): 25 
 +Use BOOTP for network configuration: false 
 +Gateway IP address: 
 +Local IP address: 
 +Local IP address mask: 
 +Default server IP address: 10.0.0.251 
 +Console baud rate: 115200 
 +GDB connection port: 9000 
 +Force console for special debug messages: false 
 +Network debug at boot time: false 
 +Default network device: npe_eth0 
 +Update RedBoot non-volatile configuration - continue (y/n)? y 
 +... Unlock from 0x50fe0000-0x51000000: . 
 +... Erase from 0x50fe0000-0x51000000: . 
 +... Program from 0x03fe0000-0x04000000 at 0x50fe0000: . 
 +... Lock from 0x50fe0000-0x51000000: . 
 +</code> 
 + 
 +Now on reset you will boot from compact flash by default: 
 + 
 +<code> 
 ++ 
 +Trying NPE-B...success. Using NPE-B with PHY 0. 
 +Ethernet eth0: MAC address 00:d0:12:02:47:68 
 +IP: 192.168.3.2/255.255.255.0, Gateway: 0.0.0.0 
 +Default server: 10.0.0.251 
 + 
 +RedBoot(tm) bootstrap and debug environment [ROM] 
 +Gateworks certified release, version 2.02 - built 05:22:19, Mar  3 2006 
 + 
 +Platform: Gateworks Avila GW234X (IXP42X 533MHz) BE 
 +Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. 
 +Copyright (C) 2004, 2005 Gateworks Corporation 
 + 
 +RAM: 0x00000000-0x04000000, [0x000298b0-0x03fc1000] available 
 +FLASH: 0x50000000 - 0x51000000, 128 blocks of 0x00020000 bytes each. 
 +== Executing boot script in 2.500 seconds - enter ^C to abort 
 +RedBoot> fis load boot2.freebsd 
 +RedBoot> go 
 +FreeBSD ARM (Avila) boot2 v0.2 
 +- 
 +Default: /boot/kernel/kernel 
 +boot: 
 +KDB: debugger backends: ddb 
 +KDB: current backend: ddb 
 +Copyright (c) 1992-2008 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 7.1-PRERELEASE #1: Fri Sep 26 14:37:41 PDT 2008 
 +    root@trouble.errno.com:/usr/obj/nanobsd.avila/arm/usr/sam/vap_releng7/sys/G2348 
 +CPU: IXP425 533MHz rev 1 (ARMv5TE) (XScale core) 
 +  DC enabled IC enabled WB enabled LABT branch prediction enabled 
 +  32KB/32B 32-way Instruction cache 
 +  32KB/32B 32-way write-back-locking Data cache 
 +real memory  = 67108864 (64 MB) 
 +avail memory = 58359808 (55 MB) 
 +ath_hal: 0.10.5.10 (AR5210, AR5211, AR5212, AR5416, RF5111, RF5112, RF2413, RF5413, RF2133, RF2425, RF2417, REGOPS_FUNC) 
 +ixp0: <Intel IXP425> on motherboard 
 +pcib0: <IXP425 PCI Bus> on ixp0 
 +pci0: <PCI bus> on pcib0 
 +ath0: <Atheros 5413> irq 28 at device 1.0 on pci0 
 +ath0: [ITHREAD] 
 +ath0: WARNING: using obsoleted if_watchdog interface 
 +ath0: mac 10.4 phy 6.1 radio 6.3 
 +ath1: <Atheros 5413> irq 27 at device 2.0 on pci0 
 +ath1: [ITHREAD] 
 +ath1: WARNING: using obsoleted if_watchdog interface 
 +ath1: mac 10.5 phy 6.1 radio 6.3 
 +ixpclk0: <IXP425 Timer> on ixp0 
 +ixpiic0: <IXP425 GPIO-Based I2C Interface> on ixp0 
 +iicbb0: <I2C bit-banging driver> on ixpiic0 
 +iicbus0: <Philips I2C bus> on iicbb0 master-only 
 +iicbus0: <unknown card> at addr 0 
 +iic0: <I2C generic I/O> on iicbus0 
 +ad74180: <Analog Devices AD7418 ADC> at addr 0x50 on iicbus0 
 +ds16720: <Dallas Semiconductor DS1672 RTC> at addr 0xd0 on iicbus0 
 +ixpwdog0: <IXP425 Watchdog Timer> on ixp0 
 +uart0: <Non-standard ns8250 class UART with FIFOs> on ixp0 
 +uart0: [FILTER] 
 +uart0: console (115200,n,8,1) 
 +uart1: <Non-standard ns8250 class UART with FIFOs> on ixp0 
 +uart1: [FILTER] 
 +ixpqmgr0: <IXP425 Q-Manager> on ixp0 
 +ixpqmgr0: [ITHREAD] 
 +npe0: <IXP NPE-B> on ixp0 
 +npe0: [ITHREAD] 
 +npe0: remember to fix rx q setup 
 +miibus0: <MII bus> on npe0 
 +ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0 
 +ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto 
 +npe0: Ethernet address: 00:d0:12:02:47:68 
 +npe1: <IXP NPE-C> on ixp0 
 +npe1: [ITHREAD] 
 +npe1: remember to fix rx q setup 
 +miibus1: <MII bus> on npe1 
 +ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1 
 +ukphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto 
 +npe1: Ethernet address: 00:d0:12:12:47:68 
 +ata_avila0: <Gateworks Avila IDE/CF Controller> on ixp0 
 +ata_avila0: [ITHREAD] 
 +ata0: <ATA channel 0> on ata_avila0 
 +ata0: [ITHREAD] 
 +led_avila0: <Gateworks Avila GPIO connected LED> on ixp0 
 +ixpclk0: [FILTER] 
 +Timecounter "IXP425 Timer" frequency 66666600 Hz quality 1000 
 +Timecounters tick every 10.000 msec 
 +ad0: 61MB <SanDisk SDCFB-64 Vdg 1.17> at ata0-master PIO1 
 +Trying to mount root from ufs:ad0s1 
 +cp: utimes: /var/var: No such file or directory 
 +cp: chown: /var/var: No such file or directory 
 +cp: chmod: /var/var: No such file or directory 
 +cp: chflags: /var/var: No such file or directory 
 +Loading configuration files. 
 +Entropy harvesting: kickstart. 
 +Starting file system checks: 
 +/dev/ad0s1: FILE SYSTEM CLEAN; SKIPPING CHECKS 
 +/dev/ad0s1: clean, 35625 free (1 frags, 4453 blocks, 0.0% fragmentation) 
 +/dev/ad0s3: FILE SYSTEM CLEAN; SKIPPING CHECKS 
 +/dev/ad0s3: clean, 1917 free (5 frags, 239 blocks, 0.3% fragmentation) 
 +Setting hostuuid: 8902ab18-8cef-11dd-b583-00026f3f9531. 
 +Setting hostid: 0x5cb2bb66. 
 +Mounting local file systems:. 
 +Setting hostname: avila. 
 +npe0: link state changed to UP 
 +Starting Network: lo0 npe0. 
 +ifconfig: npe0: bad value 
 +Additional routing options:. 
 +/etc/rc: WARNING: run_rc_command: cannot run /sbin/devd 
 +Generating host.conf. 
 +Additional IP options:. 
 +Mounting NFS file systems:. 
 +Creating and/or trimming log files:. 
 +Starting syslogd. 
 +ELF ldconfig path: /lib /usr/lib 
 +Initial arm initialization:. 
 +Additional ABI support:. 
 +NFS access cache time=60 
 +Clearing /tmp (X related). 
 +Starting local daemons:. 
 +Updating motd. 
 +Mounting late file systems:. 
 +Starting sshd. 
 +Starting cron. 
 +Local package initialization:. 
 +Starting background file system checks in 60 seconds. 
 + 
 +Sat Sep 27 23:54:08 UTC 2008 
 + 
 +FreeBSD/arm (avila) (ttyu0) 
 + 
 +login: 
 +</code>
  
-On Avila:+==== Multiple Partitions ====
  
-  * reboot +If you use the boot2 program to boot from compact flash then it will automatically select the slice marked active.  This makes it easy to partition a flash part with multiple slices that you can fallback to in case of a problem.  If you use nanobsd to construct compact flash images the shell scripts updatep1 and updatep2 can be used to write new disk images to partition/slice 1 and 2, respectively and mark the MBR so that on reset boot2 boots from that slice.
-  * CTRL-C before kernel loading (you need to config your cua*0 as 3wire via /etc/rc.d/serial to let CTRL-C work) +
-  * load -b 0x200000 kernel.ad0 +
-  * fis create kernel.ad0 (no need to overwrite the linux-stuff) +
-  * fconfig (to adapt the new kernel)+
  
  • freebsdavila.1205644598.txt.gz
  • Last modified: 2008/03/16 05:16
  • by WarnerLosh