Last active
July 19, 2020 20:58
-
-
Save paulc/36d658f5dce313fb4b90 to your computer and use it in GitHub Desktop.
Dockstar build script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Custom kernel for Seagate DockStar (Marvell SheevaPlug based) devices. | |
# | |
# $FreeBSD: releng/10.2/sys/arm/conf/DOCKSTAR 283404 2015-05-24 15:21:47Z ian $ | |
# | |
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html | |
# | |
# The handbook is also available locally in /usr/share/doc/handbook | |
# if you've installed the doc distribution, otherwise always see the | |
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the | |
# latest information. | |
# | |
# An exhaustive list of options and more detailed explanations of the | |
# device lines is also present in the ../../conf/NOTES and NOTES files. | |
# If you are in doubt as to the purpose or necessity of a line, check first | |
# in NOTES. | |
# | |
# $FreeBSD: releng/10.2/sys/arm/conf/DOCKSTAR 283404 2015-05-24 15:21:47Z ian $ | |
# | |
#NO_UNIVERSE | |
ident DOCKSTAR | |
include "../mv/kirkwood/std.db88f6xxx" | |
makeoptions FDT_DTS_FILE=dockstar.dts | |
options SOC_MV_KIRKWOOD | |
options SCHED_4BSD # 4BSD scheduler | |
options INET # InterNETworking | |
options INET6 # IPv6 communications protocols | |
options SOFTUPDATES | |
options CD9660 # ISO 9660 filesystem | |
options FFS # Berkeley Fast Filesystem | |
options TMPFS # Efficient memory filesystem | |
options MSDOSFS # MS DOS File System (FAT, FAT32) | |
options NULLFS # NULL filesystem | |
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 GEOM_PART_BSD # BSD partition scheme | |
options GEOM_PART_MBR # MBR partition scheme | |
options GEOM_ELI # Disk encryption. | |
options GEOM_LABEL # Providers labelization. | |
options GEOM_PART_GPT # GPT partitioning | |
# Flattened Device Tree | |
device fdt | |
options FDT | |
options FDT_DTB_STATIC | |
# Misc pseudo devices | |
device bpf # Required for DHCP | |
device faith # IPv6-to-IPv4 relaying (translation) | |
device firmware # firmware(9) required for USB wlan | |
device gif # IPv6 and IPv4 tunneling | |
device loop # Network loopback | |
device md # Memory/malloc disk | |
device pty # BSD-style compatibility pseudo ttys | |
device random # Entropy device | |
device tun # Packet tunnel. | |
device ether # Required for all ethernet devices | |
device vlan # 802.1Q VLAN support | |
device wlan # 802.11 WLAN support | |
# cam support for umass and ahci | |
device scbus | |
device pass | |
device da | |
# Serial ports | |
device uart | |
# Networking | |
device mge # Marvell Gigabit Ethernet controller | |
device mii | |
device e1000phy | |
# USB | |
options USB_HOST_ALIGN=32 # Align DMA to cacheline | |
#options USB_DEBUG # Compile in USB debug support | |
device usb # Basic usb support | |
device ehci # USB host controller | |
device umass # Mass storage | |
device uhid # Human-interface devices | |
device rum # Ralink Technology RT2501USB wireless NICs | |
device uath # Atheros AR5523 wireless NICs | |
device ural # Ralink Technology RT2500USB wireless NICs | |
device zyd # ZyDAS zb1211/zb1211b wireless NICs | |
device urtw # Realtek RTL8187B/L USB | |
device upgt # Conexant/Intersil PrismGT SoftMAC USB | |
device u3g # USB-based 3G modems (Option, Huawei, Sierra) | |
# I2C (TWSI) | |
device iic | |
device iicbus | |
# Sound | |
device sound | |
device snd_uaudio | |
#crypto | |
device cesa # Marvell security engine | |
device crypto | |
device cryptodev | |
# IPSec | |
device enc | |
options IPSEC | |
options IPSEC_NAT_T | |
options TCP_SIGNATURE # include support for RFC 2385 | |
# IPFW | |
options IPFIREWALL | |
options IPFIREWALL_DEFAULT_TO_ACCEPT | |
options IPFIREWALL_VERBOSE | |
options IPFIREWALL_VERBOSE_LIMIT=100 | |
options IPFIREWALL_NAT | |
options LIBALIAS | |
options DUMMYNET | |
options IPDIVERT | |
#PF | |
device pf | |
device pflog | |
device pfsync | |
# ALTQ, required for PF | |
options ALTQ # Basic ALTQ support | |
options ALTQ_CBQ # Class Based Queueing | |
options ALTQ_RED # Random Early Detection | |
options ALTQ_RIO # RED In/Out | |
options ALTQ_HFSC # Hierarchical Packet Scheduler | |
options ALTQ_CDNR # Traffic conditioner | |
options ALTQ_PRIQ # Priority Queueing | |
options ALTQ_NOPCC # Required if the TSC is unusable | |
#options ALTQ_DEBUG | |
# Debugging | |
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols | |
options BREAK_TO_DEBUGGER | |
options ALT_BREAK_TO_DEBUGGER | |
options DDB | |
options KDB | |
#options DIAGNOSTIC | |
#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 WITNESS_KDB | |
# Enable these options for nfs root configured via BOOTP. | |
options NFSCL # Network Filesystem Client | |
options NFSLOCKD # Network Lock Manager | |
#options NFS_ROOT # NFS usable as /, requires NFSCLIENT | |
#options BOOTP | |
#options BOOTP_NFSROOT | |
#options BOOTP_NFSV3 | |
#options BOOTP_WIRED_TO=mge0 | |
# If not using BOOTP, use something like one of these... | |
#options ROOTDEVNAME=\"ufs:/dev/da0a\" | |
options ROOTDEVNAME=\"ufs:/dev/da0s2a\" | |
#options ROOTDEVNAME=\"ufs:/dev/da0p10\" | |
#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export BUILDDIR="${BUILDDIR:-$(pwd)}" | |
export MAKEOBJDIRPREFIX="${MAKEOBJDIRPREFIX:-${BUILDDIR}/obj}" | |
export DESTDIR="${DESTDIR:-${BUILDDIR}/usbroot}" | |
export DOSBOOT="${DOSBOOT:-${BUILDDIR}/dos}" | |
export DEVICE="${DEVICE:-da0}" | |
export KERNCONF="${KERNCONF:-DOCKSTAR}" | |
export ARCH="${ARCH:-arm}" | |
export TARGET_ARCH="${TARGET_ARCH:-arm}" | |
set -e | |
buildworld () { | |
( | |
cd /usr/src | |
make -j4 buildworld TARGET_ARCH="${TARGET_ARCH}" | |
make -j4 buildkernel TARGET_ARCH="${TARGET_ARCH}" KERNCONF="${KERNCONF}" | |
) | |
} | |
buildkernel () { | |
( | |
cd /usr/src | |
make -j4 buildkernel TARGET_ARCH="${TARGET_ARCH}" KERNCONF="${KERNCONF}" | |
) | |
} | |
format_image() { | |
mkimg -s mbr -o root.img \ | |
-p freebsd:-'mkimg -s bsd -p freebsd-ufs::1g -p freebsd-swap::512m' \ | |
-p fat32::100m | |
} | |
format_usb() { | |
if gpart show "${DEVICE}" >/dev/null 2>/dev/null | |
then | |
echo "Device ${DEVICE} already partitioned" | |
exit | |
fi | |
sudo gpart create -s mbr "${DEVICE}" | |
sudo gpart add -t fat32 -s 100m "${DEVICE}" | |
sudo gpart add -t freebsd "${DEVICE}" | |
sudo gpart create -s bsd "${DEVICE}s2" | |
sudo gpart add -t freebsd-ufs -s 1g "${DEVICE}s2" | |
sudo gpart add -t freebsd-swap -s 512m "${DEVICE}s2" | |
sudo gpart add -t freebsd-ufs "${DEVICE}s2" | |
sudo newfs_msdos "/dev/${DEVICE}s1" | |
sudo newfs "/dev/${DEVICE}s2a" | |
sudo newfs "/dev/${DEVICE}s2d" | |
} | |
mount() { | |
sudo mount -t msdosfs "/dev/${DEVICE}s1" "${DOSBOOT}" | |
sudo mount "/dev/${DEVICE}s2a" "${DESTDIR}" | |
} | |
umount() { | |
sudo umount "${DOSBOOT}" | |
sudo umount "${DESTDIR}" | |
} | |
install() { | |
# Install distribution | |
( | |
cd /usr/src | |
sudo -E make -j4 installworld TARGET_ARCH="${TARGET_ARCH}" DESTDIR=${DESTDIR} | |
sudo -E make -j4 distribution TARGET_ARCH="${TARGET_ARCH}" DESTDIR=${DESTDIR} | |
sudo -E make -j4 installkernel TARGET_ARCH="${TARGET_ARCH}" KERNCONF="${KERNCONF}" DESTDIR=${DESTDIR} | |
) | |
# Copy kernel.bin to DOS boot partition | |
cp "${MAKEOBJDIRPREFIX}/${ARCH}.${TARGET_ARCH}/usr/src/syc/${KERNCONF}/kernel.bin" "${DOSBOOT}" | |
# Configure system | |
( | |
cat >"${DESTDIR}/etc/fstab" <<'EOM' | |
# Device Mountpoint FStype Options Dump Pass# | |
/dev/da0s2a / ufs rw,noatime 1 1 | |
/dev/da0s2b none swap sw 0 0 | |
/dev/da0s2d /data ufs rw,noatime 1 2 | |
EOM | |
cat >"${DESTDIR}/etc/rc.conf" <<'EOM' | |
sshd_enable="yes" | |
hostname="dockstar" | |
ifconfig_mge0="dhcp" | |
sendmail_enable="no" | |
sendmail_submit_enable="no" | |
sendmail_outbound_enable="no" | |
sendmail_msp_queue_enable="no" | |
syslogd_flags="-ss" | |
ntpd_enable="yes" | |
ndpd_flags="-I mge0" | |
ntpd_sync_on_start="yes" | |
EOM | |
ex -s "${DESTDIR}/etc/motd" <<'EOM' | |
2,$d | |
wq | |
EOM | |
ex -s c"${DESTDIR}/etc/crontab" <<'EOM' | |
/atrun/s/^/#/ | |
/adjkerntz -a/s/^/#/ | |
wq | |
EOM | |
) | |
} | |
buildkernel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment