MFM Software Image Build

Note: This is currently incomplete.

Top of revision B board information

If you have any questions, improvements, or corrections email me at the address at the bottom of the page.

This page documents how I made the image for flashing the BBB for the MFM reader/emulator.

Note:For this old image you need to update /etc/apt/sources.list and use apt-get update -o Acquire::Check-Valid-Until=false

For Debian images are available from here and testing images here. NOTE: Don't use an image later than the 3.8 kernel. They don't support the method I am using to configure the BBB pins. I started with flashing BBB-eMMC-flasher-debian-7.8-console-armhf-2015-07-17-2gb.img.xz. onto the BBB. The images frequently change so that one is likely to not be available.

Install various packages. Do the following logged into the BBB as root.

Setup repos.rcn-ee.net repo. Not sure if needed.
   wget https://repos.rcn-ee.net/debian/pool/main/r/rcn-ee-archive-keyring/rcn-ee-archive-keyring_2015.07.05~bpo70+20150705+1_all.deb
   dpkg -i rcn-ee-archive-keyring_2015.07.05~bpo70+20150705+1_all.deb
   sh -c "echo 'deb [arch=armhf] http://repos.rcn-ee.net/debian wheezy main' >> /etc/apt/sources.list"
   sh -c "echo '#deb-src [arch=armhf] http://repos.rcn-ee.net/debian wheezy main' >> /etc/apt/sources.list"


# fetch package list
apt-get update
# bring all programs to current version
apt-get -y upgrade
# for power button
apt-get -y install acpid
# to build my software
apt-get -y install binutils-dev gcc make am335x-pru-package binutils-dev device-tree-compiler
# Set time on boot, only useful it BBB has network access
apt-get -y install ntpdate
# may be useful
apt-get -y install git zip usbutils wireless-tools wpasupplicant
# mount windows file system
apt-get -y install cifs-utils
# mount nfs file system
apt-get -y install nfs-common
# to get access to running process stdout
apt-get -y install reptyr
# binary patch programs
apt-get -y install xdelta rdiff
# For systemd-analize
apt-get install python-dbus python-cairo
#Enable usb ethernet address assignment
apt-get install udhcpd
#killall
apt-get install psmisc
#Installed on recent images
apg-get install kpartx mtools



#Disable stuff not normally needed. Below doesn't work since not really
#systemd service even though is pretends to be one.
#systemctl disable nfs-common.service
update-rc.d nfs-common disable
update-rc.d winbind disable


# configure for my software
echo options uio_pruss extram_pool_sz=1048576 > /etc/modprobe.d/uio_pruss.conf
vi /boot/uEnv.txt
  Uncommented cape disable line to as shown below
  ##Disable HDMI (v3.8.x)
  cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

   (Change u-boot to not stop boot on any character received to prevent boot
    faulures).
# u-boot
git clone git://git.denx.de/u-boot.git
cd u-boot/
git checkout v2015.07 -b tmp
wget -c http://rcn-ee.com/repos/git/u-boot-patches/v2015.07/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

Edited include/configs/am335x_evm.h and added after
 #define CONFIG_SYS_I2C_MULTI_EEPROMS
the lines
 #define CONFIG_AUTOBOOT_KEYED           1
 #define CONFIG_AUTOBOOT_STOP_STR        "s"

make distclean
make am335x_evm_defconfig
make
# These are only for the image I started with. u-boot is located in
# different locations on other releases.
dd if=MLO of=/dev/mmcblk0 count=1 seek=1 bs=128k
dd if=u-boot.img of=/dev/mmcblk0 count=2 seek=1 bs=384k

changed /etc/dhcp/dhclient.conf to limit delay on board startup
if ethernet cable not plugged in and reduce time till address aquired
when cable plugged in.
timeout 5;
retry 15;
initial-interval 1;

To prevent udhcpd not always starting
commented out in /opt/scripts/boot/autoconfigure_usb0.sh
        #/usr/sbin/udhcpd -S ${deb_udhcpd_conf}


Download latest mfm code .tgz file and copy it to BBB and build.
scp mfm_emu_powerfail*.tgz root@ipaddr:
ssh root@ipaddr
tar -xzf mfm_emu_powerfail_*.tgz
cd mfm
make
cd ../emu
make
cd ../powerfail
make
exit (or poweroff)

Created /etc/mfm_emu.conf and /etc/systemd/system/mfm_emu.service. 
Files referenced may not be the latest.

Modified /opt/scripts/boot/am335x_evm.sh to prevent endless
reboots and reflashing if mfm board installed since it does auto
power back on. Making halt do what it is supposed to would be better.
if [ ! "x${are_we_flasher}" = "x" ] ; then
        halt
        exit
to
if [ ! "x${are_we_flasher}" = "x" ] ; then
        sync
        echo 0 > /sys/class/leds/beaglebone\:green\:usr0/brightness
        echo 0 > /sys/class/leds/beaglebone\:green\:usr1/brightness
        echo 0 > /sys/class/leds/beaglebone\:green\:usr2/brightness
        echo 0 > /sys/class/leds/beaglebone\:green\:usr3/brightness
        halt -f
        exit

Make small empty fatfs file
/bin/dd if=/dev/zero of=/opt/empty_fatfs bs=1k count=50
/sbin/mkfs.vfat /opt/empty_fatfs
Modified /opt/scripts/boot/am335x_evm.sh to enable serial, usb ethernet,
   and storage gadgets. 
Commented out
                #modprobe g_ether ${g_network} || true
And added after it
                modprobe g_multi file=/tmp/empty_fatfs cdrom=0 ro=0 stall=0 removable=1 nofua=1 ${g_network} || true
Note: There is no syncronization/locking so if you mount the filesystem
on the beagelbone and both write bad things are likely to happen. Not sure if
one side read only works ok.



# To copy back to microSD, put card in BBB after boot starts to prevent
# trying to boot from it
apt-get clean
mount /dev/mmcblk1p1 /mnt/
cp /root/u-boot/MLO /mnt/opt/backup/uboot/
cp /root/u-boot/u-boot.img /mnt/opt/backup/uboot/
# Save 215 MB
rm -rf /root/u-boot
# (-n to dry run, -v to show files copied
rsync -aAx --delete /* /mnt/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/uEnv.txt,/boot,/var/log,/etc/ssh}

Using zerofree command on partition can shrink image

# uncomment the below line in /mnt/boot/uEnv.txt to disable HDMI interface
  cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
To copy card to image (device name only right for my computer):
dd if=/dev/sdb bs=100k count=17408 | xz > BBB-mfm-emu.xz

To disable/enable flashing comment/uncomment boot/uEnv.txt cmdline= line

Issues

Enabling Ethernet seems to make poweroff and possibly startup wait for a while. The -f flag on poweroff/halt prevents that delay.

There are various issues with detecting when USB devices are plugged in. Hopefully a later kernel version will fix these and have the cape support needed for confiugring the BBB pins. I haven't investigated too much since they are only a minor nuisance for my usage.

If you wish to configure USB wireless device this is the first page I found that worked for me.



Feel free to contact me, David Gesswein djg@pdp8online.com with any questions, comments on the web site, or if you have related equipment, documentation, software etc. you are willing to part with.  I am interested in anything PDP-8 related, computers, peripherals used with them, DEC or third party, or documentation. 

PDP-8 Home Page   PDP-8 Site Map   PDP-8 Site Search