From 01559d9378402c1f2a073eb3d872c4454d97e271 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 8 Jan 2014 12:06:00 -0800 Subject: [PATCH 4/4] PCEngines' Alix support. --- README.md | 1 + board/Alix/README | 23 +++++ board/Alix/conf/ALIX10 | 165 ++++++++++++++++++++++++++++++++++++ board/Alix/overlay/boot.config | 2 + board/Alix/overlay/boot/loader.conf | 4 + board/Alix/overlay/etc/fstab | 5 ++ board/Alix/overlay/etc/pf.conf | 24 ++++++ board/Alix/overlay/etc/rc.conf | 26 ++++++ board/Alix/overlay/etc/ttys | 4 + board/Alix/setup.sh | 41 +++++++++ board/Alix/util/mount_image.sh | 5 ++ board/Alix/util/unmount_image.sh | 3 + config.sh.sample | 1 + 13 files changed, 304 insertions(+) create mode 100644 board/Alix/README create mode 100644 board/Alix/conf/ALIX10 create mode 100644 board/Alix/overlay/boot.config create mode 100644 board/Alix/overlay/boot/loader.conf create mode 100644 board/Alix/overlay/etc/fstab create mode 100644 board/Alix/overlay/etc/pf.conf create mode 100644 board/Alix/overlay/etc/rc.conf create mode 100644 board/Alix/overlay/etc/ttys create mode 100644 board/Alix/setup.sh create mode 100644 board/Alix/util/mount_image.sh create mode 100644 board/Alix/util/unmount_image.sh diff --git a/README.md b/README.md index 134e2e5..5f4690e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Crochet is a tool for building bootable FreeBSD images. It can currently build images for: +* [Alix](http://pcengines.ch/alix.htm) * [BeagleBone](http://beagleboard.org/) * [PandaBoard](http://pandaboard.org/) * [RaspberryPi](http://www.raspberrypi.org/) diff --git a/board/Alix/README b/board/Alix/README new file mode 100644 index 0000000..dfef842 --- /dev/null +++ b/board/Alix/README @@ -0,0 +1,23 @@ + +================================================================ + +What is Alix +-------------------------------- + +Alix is a family of reliable, robust, superior quality communications computers + + http://pcengines.ch/alix.htm + +================================================================ + +How to Boot the Alix +-------------------------------- + +1. Connect the DB-9 serial port on the Alix to your system. This + will allow you to view the console output. Console is 115200 bps. + +2. Insert the CF card into your Soekris + +3. Power on the Alix by plugging it in + + diff --git a/board/Alix/conf/ALIX10 b/board/Alix/conf/ALIX10 new file mode 100644 index 0000000..57dc3d5 --- /dev/null +++ b/board/Alix/conf/ALIX10 @@ -0,0 +1,165 @@ +cpu I586_CPU +options CPU_GEODE +ident ALIX + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support + +options SCHED_ULE # ULE scheduler +options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options TCP_OFFLOAD # TCP offload +options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options QUOTA # Enable disk quotas for UFS +options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +#options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_RAID # Soft RAID functionality. +options GEOM_LABEL # Provides labelization +#options COMPAT_FREEBSD4 # Compatible with FreeBSD4 +#options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +#options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +#options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options STACK # stack(9) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options AUDIT # Security event auditing +options CAPABILITY_MODE # Capsicum capability mode +options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors +options MAC # TrustedBSD MAC Framework +options KDTRACE_HOOKS # Kernel DTrace hooks +options DDB_CTF # Kernel ELF linker loads CTF data +options INCLUDE_CONFIG_FILE # Include this file in kernel +options IPSEC +options IPSEC_NAT_T + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +options KDB_TRACE # Print a stack trace for a panic. +options KDB_UNATTENDED +# For full debugger support use (turn off in stable branch): +options DDB # Support DDB. +#options GDB # Support remote GDB. +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones + +# Bus support. +device eisa +device pci +device iicbus + + +# ATA controllers +device ata # Legacy ATA/SATA controllers +options ATA_STATIC_ID # Static device numbering +device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA +device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA + +# ATA/SCSI peripherals +device scbus # SCSI bus (required for ATA/SCSI) +device ch # SCSI media changers +device da # Direct Access (disks) +device pass # Passthrough device (direct ATA/SCSI access) +#device ctl # CAM Target Layer + +# atkbdc0 controls both the keyboard and the PS/2 mouse +device atkbdc # AT keyboard controller +device atkbd # AT keyboard +device psm # PS/2 mouse + +device kbdmux # keyboard multiplexer + +device vga # VGA video card driver +options VESA # Add support for VESA BIOS Extensions (VBE) + +device splash # Splash screen and screen saver support + +# syscons is the default console driver, resembling an SCO console +device sc +options SC_PIXEL_MODE # add support for the raster text mode + +# Add suspend/resume support for the i8254. +device pmtimer + +# Serial (COM) ports +device uart # Generic UART driver + +# PCI Ethernet NICs that use the common MII bus controller code. +# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! +device miibus # MII bus support +device vr # VIA Rhine, Rhine II + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device padlock_rng # VIA Padlock RNG +device rdrand_rng # Intel Bull Mountain RNG +device ether # Ethernet support +device vlan # 802.1Q VLAN support +device tun # Packet tunnel. +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device faith # IPv6-to-IPv4 relaying (translation) +device firmware # firmware assist module + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# USB support +options USB_DEBUG # enable debug msgs +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device usb # USB Bus (required) +device ukbd # Keyboard +device umass # Disks/Mass storage - Requires scbus and da + +#ALIX additions +device glxiic +device glxsb +device crypto +device cryptodev + +#pf +device pf +device pflog +device pfsync + +#carp +device carp + +#altq +options ALTQ +options ALTQ_CBQ # Class Based Queuing (CBQ) +options ALTQ_RED # Random Early Detection (RED) +options ALTQ_RIO # RED In/Out +options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC) +options ALTQ_PRIQ # Priority Queuing (PRIQ) +options ALTQ_NOPCC # Required for SMP build + diff --git a/board/Alix/overlay/boot.config b/board/Alix/overlay/boot.config new file mode 100644 index 0000000..3567570 --- /dev/null +++ b/board/Alix/overlay/boot.config @@ -0,0 +1,2 @@ +-h -S115200 + diff --git a/board/Alix/overlay/boot/loader.conf b/board/Alix/overlay/boot/loader.conf new file mode 100644 index 0000000..3ba7c16 --- /dev/null +++ b/board/Alix/overlay/boot/loader.conf @@ -0,0 +1,4 @@ +console="comconsole" +comconsole_speed=115200 +beastie_disable="YES" +hint.glxiic.0.irq="7" diff --git a/board/Alix/overlay/etc/fstab b/board/Alix/overlay/etc/fstab new file mode 100644 index 0000000..d49ce0a --- /dev/null +++ b/board/Alix/overlay/etc/fstab @@ -0,0 +1,5 @@ +/dev/ada0s1 / ufs rw,noatime 1 1 +md /tmp mfs rw,noatime,-s30m 0 0 +md /var/log mfs rw,noatime,-s15m 0 0 +md /var/tmp mfs rw,noatime,-s5m 0 0 + diff --git a/board/Alix/overlay/etc/pf.conf b/board/Alix/overlay/etc/pf.conf new file mode 100644 index 0000000..59725b4 --- /dev/null +++ b/board/Alix/overlay/etc/pf.conf @@ -0,0 +1,24 @@ +# options +set block-policy return +set optimization conservative + +# normalization +scrub in all +scrub out all + +# default, deny everything +block in log all +pass out quick + +#icmp +pass out inet proto icmp from any to any keep state +pass in quick inet proto icmp from any to any keep state + +#ssh +pass out inet proto tcp from any to any port 22 keep state +pass in quick inet proto tcp from any to any port 22 keep state + +#localhost +pass in quick on lo0 all +pass out quick on lo0 all + diff --git a/board/Alix/overlay/etc/rc.conf b/board/Alix/overlay/etc/rc.conf new file mode 100644 index 0000000..0a13c74 --- /dev/null +++ b/board/Alix/overlay/etc/rc.conf @@ -0,0 +1,26 @@ +hostname="alix" +#ntpdate_enable="YES" +sshd_enable="YES" + +# pf +pf_enable="YES" +pf_rules="/etc/pf.conf" +pf_flags="" +pflog_enable="YES" +pflog_logfile="/var/log/pflog" +pflog_flags="" + +# minimal network config +ifconfig_sis0="DHCP" +ifconfig_sis1="NOAUTO" +ifconfig_sis2="NOAUTO" + +# services we don't need +cron_enable="NO" +syslogd_enable="NO" + +# turn off sendmail +sendmail_submit_enable="NO" +sendmail_outbound_enable="NO" +sendmail_msp_queue_enable="NO" + diff --git a/board/Alix/overlay/etc/ttys b/board/Alix/overlay/etc/ttys new file mode 100644 index 0000000..27b661f --- /dev/null +++ b/board/Alix/overlay/etc/ttys @@ -0,0 +1,4 @@ +console none unknown off secure +ttyu0 "/usr/libexec/getty std.115200" xterm on secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/board/Alix/setup.sh b/board/Alix/setup.sh new file mode 100644 index 0000000..7fb6b48 --- /dev/null +++ b/board/Alix/setup.sh @@ -0,0 +1,41 @@ +TARGET_ARCH=i386 +KERNCONF=ALIX +IMAGE_SIZE=$((1024 * 1000 * 1000)) + +# copy the build config +alix_copy_buildconfig ( ) { + KERNEL_CONFIG_FILE="ALIX${FREEBSD_MAJOR_VERSION}" + echo "Copying build config ${KERNEL_CONFIG_FILE} to source tree" + cp ${BOARDDIR}/conf/${KERNEL_CONFIG_FILE} ${FREEBSD_SRC}/sys/i386/conf/${KERNCONF} +} + +strategy_add $PHASE_POST_CONFIG alix_copy_buildconfig + +# create a MBR disk with a single UFS partition +# based on instructions here: http://www.wonkity.com/~wblock/docs/html/disksetup.html +# +alix_partition_image ( ) { + # basic setup + disk_partition_mbr + disk_ufs_create + + # boot loader + echo "Installing bootblocks" + # TODO: This is broken; should use 'make install' to copy + # bootfiles to workdir, then install to disk image from there. + BOOTFILES=${FREEBSD_OBJDIR}sys/boot/i386 + echo "Boot files are at: "${BOOTFILES} + gpart bootcode -b ${BOOTFILES}/mbr/mbr ${DISK_MD} || exit 1 + gpart set -a active -i 1 ${DISK_MD} || exit 1 + bsdlabel -B -b ${BOOTFILES}/boot2/boot ${DISK_UFS_PARTITION} || exit 1 + + #show the disk + gpart show ${DISK_MD} +} + +strategy_add $PHASE_PARTITION_LWW alix_partition_image + +# Kernel installs in UFS partition +strategy_add $PHASE_FREEBSD_BOARD_INSTALL board_default_installkernel . + + diff --git a/board/Alix/util/mount_image.sh b/board/Alix/util/mount_image.sh new file mode 100644 index 0000000..bce2ad7 --- /dev/null +++ b/board/Alix/util/mount_image.sh @@ -0,0 +1,5 @@ +IMAGE=`ls ../../../work/*.img` +mdconfig -a -t vnode -f ${IMAGE} -u 0 +mkdir -p /tmp/imagemount +mount /dev/md0s1 /tmp/imagemount + diff --git a/board/Alix/util/unmount_image.sh b/board/Alix/util/unmount_image.sh new file mode 100644 index 0000000..4c3d131 --- /dev/null +++ b/board/Alix/util/unmount_image.sh @@ -0,0 +1,3 @@ +umount /tmp/imagemount +mdconfig -d -u 0 + diff --git a/config.sh.sample b/config.sh.sample index 2b0d912..258246b 100644 --- a/config.sh.sample +++ b/config.sh.sample @@ -12,6 +12,7 @@ # Uncomment one to choose the default configuration for your board. # THIS MUST BE THE FIRST LINE IN YOUR CONFIG.SH FILE! # +# board_setup Alix # board_setup BeagleBone # board_setup GenericI386 # board_setup PandaBoard -- 1.8.5.2