| | 1 | {{{ |
| | 2 | ## Hack to find memory card and have partion entries re-read |
| | 3 | # - No cards: |
| | 4 | # dd: /dev/da0: Device not configured |
| | 5 | # - Inactive card: |
| | 6 | # dd: /dev/da4: Operation not permitted |
| | 7 | # - Active card: |
| | 8 | # 0+0 records in |
| | 9 | # 0+0 records out |
| | 10 | # 0 bytes transferred in 0.000018 secs (0 bytes/sec) |
| | 11 | }}} |
| | 12 | build# ls /dev/da? | xargs -I %%DA%% -n 1 dd if=/dev/zero of=%%DA%% count=0 |
| | 13 | |
| | 14 | Hack to _really_ all old partition information is detroyed |
| | 15 | build# dd if=/dev/zero of=/dev/da4 bs=1m count=1 |
| | 16 | |
| | 17 | build# fdisk -I /dev/da4 |
| | 18 | build# echo "a: * * 4.2BSD" | bsdlabel -R -B -m i386 /dev/da4s1 /dev/stdin |
| | 19 | build# newfs /dev/da4s1a |
| | 20 | build# mount /dev/da4s1a /mnt |
| | 21 | |
| | 22 | build# mkdir -p /usr/data/8.0-RC2 |
| | 23 | build# cd /usr/data/8.0-RC2 |
| | 24 | |
| | 25 | build# mkdir kernels base manpages |
| | 26 | |
| | 27 | build# cd base; echo 'mget *' | ftp -i ftp://ftp.nl.freebsd.org/pub/FreeBSD/releases/i386/8.0-RC2/base/ |
| | 28 | build# cd kernels; echo 'mget *' | ftp -i ftp://ftp.nl.freebsd.org/pub/FreeBSD/releases/i386/8.0-RC2/kernels/ |
| | 29 | build# cd manpages; echo 'mget *' | ftp -i ftp://ftp.nl.freebsd.org/pub/FreeBSD/releases/i386/8.0-RC2/manpages/ |
| | 30 | |
| | 31 | More sophisticated approach (rsync not in base) |
| | 32 | build# rsync -vaz ftp.nl.freebsd.org::FreeBSD/releases/i386/8.0-RC2/kernels . |
| | 33 | |
| | 34 | |
| | 35 | |
| | 36 | build# setenv DESTDIR /mnt |
| | 37 | build# (cd base; sh install.sh) |
| | 38 | |
| | 39 | To disable prompting build# (cd base; cat base.?? | tar --unlink -xpzf - -C $DESTDIR) |
| | 40 | build# (cd kernels; sh install.sh generic) |
| | 41 | build# (cd manpages; sh install.sh) |
| | 42 | |
| | 43 | Activate right kernel |
| | 44 | build# rm -r /mnt/boot/kernel/ ; mv /mnt/boot/GENERIC/ /mnt/boot/kernel |
| | 45 | |
| | 46 | Need resolving power at later stage inside chroot |
| | 47 | build# cp /etc/resolv.conf /mnt/etc/ |
| | 48 | build# chroot /mnt |
| | 49 | |
| | 50 | Important: if you FAIL to chroot and continue you will now start destroying your build system |
| | 51 | |
| | 52 | Need rw on first boot for ssh keys and such: |
| | 53 | chroot# echo "/dev/ad0s1a / ufs rw,noatime 0 0" > /etc/fstab |
| | 54 | On Soekris net4801 v1.33 Flash is secondary: |
| | 55 | chroot# echo "/dev/ad1s1a / ufs rw,noatime 0 0" > /etc/fstab |
| | 56 | |
| | 57 | {{{ |
| | 58 | chroot# cat <<EOF > /boot/loader.conf |
| | 59 | console=comconsole |
| | 60 | autoboot_delay=3 |
| | 61 | |
| | 62 | hw.ata.ata_dma=0 # Soekris boot failure |
| | 63 | EOF |
| | 64 | }}} |
| | 65 | |
| | 66 | Serial console boot only: |
| | 67 | chroot# echo "-h" > /boot.config |
| | 68 | |
| | 69 | Enable serial console: |
| | 70 | chroot# sed '/ttyu0/ s/off/on /' /etc/ttys > /etc/ttys.new && mv /etc/ttys.new /etc/ttys |
| | 71 | Cosmetic: disable all vidconsoles as a soekris embedded device does not have any: |
| | 72 | |
| | 73 | chroot# sed '/ttyv[0-7]/ s/on /off/g' /etc/ttys > /etc/ttys.new && mv /etc/ttys.new /etc/ttys |
| | 74 | |
| | 75 | Accounting & access control |
| | 76 | chroot# echo "sshd_enable=YES" >> /etc/rc.conf |
| | 77 | chroot# passwd rootAdministive user (admin for example) |
| | 78 | |
| | 79 | chroot# adduser -s /bin/csh -G wheel |
| | 80 | chroot# echo '%wheel ALL=(ALL) ALL' >> /usr/local/etc/sudoers |
| | 81 | |
| | 82 | Networking |
| | 83 | chroot# echo "hostname=riff.vanderzwet.net" >> /etc/rc.conf |
| | 84 | |
| | 85 | # Package installation using 7.2 kernel and 8.0-RC2 world is core dumping, postponing for later stage |
| | 86 | |
| | 87 | # Make any other optional changes before first boot |
| | 88 | chroot# vi /etc/rc.conf |
| | 89 | |
| | 90 | chroot# exit |
| | 91 | build# umount /mnt |
| | 92 | |
| | 93 | Note: NOT READY YET: Insert card into embedded define and get yourself a prompt, using serial of ssh login. |
| | 94 | |
| | 95 | Install the packages you like: |
| | 96 | node# pkg_add -r tinyproxy sudo vim-lite |
| | 97 | |
| | 98 | node# echo "update_motd=NO" >> /etc/rc.conf |
| | 99 | |
| | 100 | dnsmasq used for local network dns and dhcp: |
| | 101 | node# echo "dnsmasq_enable=YES" >> /etc/rc.conf |
| | 102 | |
| | 103 | {{{ |
| | 104 | node# cat <<EOF > /usr/local/etc/dnsmasq.conf |
| | 105 | interface=sis0 |
| | 106 | |
| | 107 | dhcp-range=192.168.42.100,192.168.42.200 |
| | 108 | |
| | 109 | domain=vanderzwet.net |
| | 110 | EOF |
| | 111 | }}} |
| | 112 | |
| | 113 | |
| | 114 | node# echo "ntpd_enable=YES" >> /etc/rc.conf |
| | 115 | {{{ |
| | 116 | node# cat <<EOF > /etc/ntp.conf |
| | 117 | server 0.nl.pool.ntp.org |
| | 118 | server 1.nl.pool.ntp.org |
| | 119 | server 2.nl.pool.ntp.org |
| | 120 | |
| | 121 | driftfile /var/db/ntp.drift |
| | 122 | EOF |
| | 123 | }}} |
| | 124 | |
| | 125 | node# (sed '3,$ d' /etc/motd; echo "WWW: http://rickvanderzwet.nl" ) > /etc/motd.new; mv /etc/motd.new /etc/motd |
| | 126 | |
| | 127 | |
| | 128 | node# echo "tmpmfs=YES" >> /etc/rc.conf |
| | 129 | Note: You could make /var completely read-only, but I hate the details like package management getting lost. Flash cards these days are cheap anyways |
| | 130 | |
| | 131 | Make read-only |
| | 132 | node# echo "varmfs=YES" >> /etc/rc.conf |
| | 133 | node# sed '/1a/ s/rw/ro/' /etc/fstab > /etc/fstab.new; mv /etc/fstab.new /etc/fstab |