Changes between Version 11 and Version 12 of FreeBSDOnEmbeddedDevice
- Timestamp:
- Feb 2, 2012, 11:25:11 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FreeBSDOnEmbeddedDevice
v11 v12 22 22 build# setenv RELEASE 9.0-RELEASE 23 23 build# mkdir -p /usr/data/$RELEASE 24 24 25 build# cd /usr/data/$RELEASE 25 26 … … 42 43 Need resolving power at later stage inside chroot: 43 44 build# cp /etc/resolv.conf /mnt/etc/ 45 46 Need ssh-keygen to work, so need access to /dev/urandom 47 build# mount -t devfs devfs /mnt/dev 48 44 49 build# chroot /mnt 45 46 50 Important: if you FAIL to chroot and continue you will now start destroying your build system 47 51 48 Need rw on first boot for ssh keys and such: 52 Tip: Having your flash living in read-only gives you added security and increases the live-time of your (older) Flash cards. read-write is more convenient But you will need to do some tricks as some programs need rw on first boot for ssh keys and such. 53 49 54 chroot# echo "/dev/ada0s1 / ufs ro,noatime 0 1" > /etc/fstab 50 55 … … 73 78 == Accounting & access control == 74 79 chroot# echo "sshd_enable=YES" >> /etc/rc.conf 80 chroot# service sshd keygen 81 75 82 chroot# pw usermod root -w random 76 83 … … 81 88 82 89 == Networking == 83 chroot# echo "hostname=riff.vanderzwet.net" >> /etc/rc.conf 90 chroot# hostname riff.vanderzwet.net 91 chroot# echo hostname=`hostname` >> /etc/rc.conf 84 92 85 Make any other optional changes before first boot inside chroot(8):86 chroot# vi /etc/rc.conf87 88 89 chroot# exit90 build# umount /mnt91 92 = Initial boot =93 Note: NOT READY YET: Insert card into your embedded device and get yourself a prompt, using serial of ssh login.94 93 == Package install == 95 94 … … 104 103 chroot# pkg_add -r dnsmasq 105 104 chroot# echo "dnsmasq_enable=YES" >> /etc/rc.conf 105 chroot# setenv DOMAIN `hostname | sed 's/^[^.]*.//'` 106 106 107 107 {{{ 108 108 #!sh 109 109 node# cat <<EOF > /usr/local/etc/dnsmasq.conf 110 interface=vr0 110 interface=bridge0 111 no-dhcp-interface=vr1 112 cache-size=10000 111 113 112 dhcp-range=192.168.42.100,192.168.42.200 114 localise-queries 115 domain=${DOMAIN}. 113 116 114 domain=vanderzwet.net 117 dhcp-range=bridge0,192.168.42.100,192.168.42.200 118 dhcp-host=00:00:24:c1:1d:d0,192.168.42.130 119 dhcp-host=00:13:d3:a7:24:51,192.168.42.165 120 dhcp-option=option:router,192.168.42.1 121 122 server=/wleiden.net/172.20.145.129 123 `jot 16 16 | xargs -n 1 -I % echo server=/%.172.in-addr.arpa/172.20.145.129` 115 124 EOF 116 125 }}} … … 130 139 === motd === 131 140 132 node# (sed '3,$ d' /etc/motd; echo "WWW: http://rickvanderzwet.nl" ) > /etc/motd.new; mv /etc/motd.new /etc/motd141 node# (sed '3,$ d' /etc/motd; echo "WWW: riff.vanderzwet.net - http://rickvanderzwet.nl" ) > /etc/motd.new; mv /etc/motd.new /etc/motd 133 142 134 143 === Flash disk protection === 135 144 chroot# echo "update_motd=NO" >> /etc/rc.conf 136 145 chroot# echo "tmpmfs=YES" >> /etc/rc.conf 137 Tip: You could make /var completely read-only, but I hate the details like package management getting lost. Flash cards these days are cheap anyways, mine lived for 1 year after extensive use. Of course with read-only this will be _much_ longer.138 146 chroot# echo "varmfs=YES" >> /etc/rc.conf 139 Tip: Having your flash living in read-only gives you added security and increases the live-time of your (older) Flash cards 147 148 Tip: I hate the details like package management details getting lost. Flash cards these days are cheap anyways, mine lived for 1 year after extensive use. Of course with read-only this will be _much_ longer. 149 150 140 151 chroot# sed '/1a/ s/rw/ro/' /etc/fstab > /etc/fstab.new; mv /etc/fstab.new /etc/fstab 152 141 153 142 154 === various === 143 155 node# pkg_add -r tinyproxy sudo vim-lite 144 156 145 = Put into production =146 node# reboot147 157 148 = Adding packages = 158 = Initial boot = 159 Note: NOT READY YET: Insert card into your embedded device and get yourself a prompt, using serial of ssh login. 160 161 162 = Production Maintenance = 163 164 == Adding packages == 149 165 Tip: As space is limited unpacking packages can result in I/O errors due to (memory) disks which run out of space. Installing for example the package apache22 goes as follows: 150 166 node# mkdir /usr/local/tmp 151 167 node# setenv PKG_TMPDIR /usr/local/tmp 152 168 node# pkg_add -r -t /usr/local/tmp/instmp.XXXXXX apache22 169 170 Make any other optional changes before first boot inside chroot(8): 171 chroot# vi /etc/rc.conf 172 173 chroot# exit 174 build# umount /mnt