Changes between Initial Version and Version 1 of Archive/FreeBSDOnEmbeddedDevice


Ignore:
Timestamp:
11/01/09 15:45:09 (15 years ago)
Author:
Rick van der Zwet
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Archive/FreeBSDOnEmbeddedDevice

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