Version 27 (modified by Rick van der Zwet, 12 years ago) ( diff )


Initial disk configuration

## Hack to find memory card and have partion entries re-read
# - No cards:
#   dd: /dev/da0: Device not configured
# - Inactive card:
#   dd: /dev/da4: Operation not permitted
# - Active card:
#   0+0 records in
#   0+0 records out
#   0 bytes transferred in 0.000018 secs (0 bytes/sec)

build# ls /dev/da? | xargs -I %%DA%% -n 1 dd if=/dev/zero of=%%DA%% count=0 build# setenv DA /dev/da0

Hack to really have all old partition information is detroyed: build# dd if=/dev/zero of=$DA bs=1m count=1

build# fdisk -BI $DA build# echo "a: * * 4.2BSD" | bsdlabel -R -B -m i386 ${DA}s1 /dev/stdin build# newfs ${DA}s1a build# mount ${DA}s1a /mnt

Disk population

build# setenv RELEASE 8.0-RELEASE build# mkdir -p /usr/data/$RELEASE build# cd /usr/data/$RELEASE

build# mkdir kernels base manpages build# (cd base; echo 'mget *' | ftp -i$RELEASE/base/) build# (cd kernels; echo 'mget *' | ftp -i$RELEASE/kernels/) build# (cd manpages; echo 'mget *' | ftp -i$RELEASE/manpages/)

More sophisticated approach (rsync not in base): build# rsync -vaz$RELEASE/kernels .

build# setenv DESTDIR /mnt

build# (cd base; cat base.?? | tar --unlink -xpzf - -C $DESTDIR) build# (cd kernels; sh generic) build# (cd manpages; sh

Tip: Soekris 2521 requires CPU_ELAN which is not included into the kernel by default. For optimal performance compile the kernel yourself

Activate right kernel: build# rm -r /mnt/boot/kernel/ ; mv /mnt/boot/GENERIC/ /mnt/boot/kernel

Disk configuration

Need resolving power at later stage inside chroot: build# cp /etc/resolv.conf /mnt/etc/ build# chroot /mnt

Important: if you FAIL to chroot and continue you will now start destroying your build system

Need rw on first boot for ssh keys and such: chroot# echo "/dev/ad0s1a / ufs rw,noatime 0 1" > /etc/fstab Tip: On Soekris net4801 v1.33 Flash is secondary net4801# echo "/dev/ad1s1a / ufs rw,noatime 0 1" > /etc/fstab

Make sure to continue to check the disks on reboot, instead of waiting for user input: chroot# echo "fsck_y_enable=YES" >> /etc/rc.conf

chroot# cat <<EOF > /boot/loader.conf

hw.ata.ata_dma=0   # Soekris boot failure

Serial console boot only: chroot# echo "-h" > /boot.config

Enable serial console: chroot# sed '/ttyu0/ s/off/on /' /etc/ttys > /etc/ && mv /etc/ /etc/ttys

Cosmetic: disable all vidconsoles as a soekris embedded device does not have any: chroot# sed '/ttyv[0-7]/ s/on /off/g' /etc/ttys > /etc/ && mv /etc/ /etc/ttys

Accounting & access control

chroot# echo "sshd_enable=YES" >> /etc/rc.conf chroot# pw usermod root -w random

Administive user (admin for example): chroot# setenv FTP_PASSIVE_MODE yes chroot# pkg_add -r sudo chroot# pw useradd admin -G wheel -c 'Admin User' -s /bin/csh -m -w random chroot# echo '%wheel ALL=(ALL) ALL' >> /usr/local/etc/sudoers


chroot# echo "" >> /etc/rc.conf

Package installation using 7.2 kernel and 8.0-RC2 world is core dumping, postponing for later stage

Make any other optional changes before first boot inside chroot(8): chroot# vi /etc/rc.conf

chroot# exit build# umount /mnt

Initial boot

Note: NOT READY YET: Insert card into your embedded device and get yourself a prompt, using serial of ssh login.

Package install


dnsmasq used for local network dns and dhcp: node# pkg_add -r dnsmasq node# echo "dnsmasq_enable=YES" >> /etc/rc.conf

node# cat <<EOF > /usr/local/etc/dnsmasq.conf



node# echo "ntpd_enable=YES" >> /etc/rc.conf

node# cat <<EOF > /etc/ntp.conf

driftfile /var/db/ntp.drift


node# (sed '3,$ d' /etc/motd; echo "WWW:" ) > /etc/; mv /etc/ /etc/motd

Flash disk protection

node# echo "update_motd=NO" >> /etc/rc.conf node# echo "tmpmfs=YES" >> /etc/rc.conf 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. node# echo "varmfs=YES" >> /etc/rc.conf Tip: Having your flash living in read-only gives you added security and increases the live-time of your (older) Flash cards node# sed '/1a/ s/rw/ro/' /etc/fstab > /etc/; mv /etc/ /etc/fstab


node# pkg_add -r tinyproxy sudo vim-lite

Put into production

node# reboot

Adding packages

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: node# mkdir /usr/local/tmp node# setenv PKG_TMPDIR /usr/local/tmp node# pkg_add -r -t /usr/local/tmp/instmp.XXXXXX apache22

Note: See TracWiki for help on using the wiki.