Hardware Setup
First of all here is the result:
Connection Diagram
Expand Omega Storage with SD card
To install Octoprint on Omega2 you will have to first expand the storage on Omega2+
plug a micro SD card into the Omega2+.
it will show up as /dev/mmcblk0
- format the SD card to EXT4 (you can skip this if you already have you sd card in EXT4 format)
install disk utilities:
opkg update
opkg install fdisk e2fsprogs block-mount
- partition the SD card to Linux partition using fdisk
- format SD card
umount /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p1
- mount SD card
mount the SD card
umount /dev/mmcblk0p1
mkdir /mnt/SD
mount /dev/mmcblk0p1 /mnt/SD
- Copy current /overlay directory
tar -C /overlay -cvf - . | tar -C /mnt/SD/ -xf -
umount /mnt/SD
- Setting up the
/overlay
Directory to Automount on Startup
block detect > /etc/config/fstab
- edit
/etc/config/fstab
changeoption target '/mnt/mmcblk0p1'
tooption target '/overlay'
andoption enabled '0'
tooption enabled '1'
reboot
after reboot you can verify if you /overlay
is mounted properly by running df
you should see something like this:
/dev/mmcblk0p1 7374776 33328 6947108 0% /overlay
Build Octoprint
- install required packages
edit/etc/opkg/distfeeds.conf
uncomment
src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages
opkg update
opkg install python python-pip unzip
pip install --upgrade setuptools
- expand
/tmp
folder on the Omega
mkdir /overlay/tmp
rm -rf /overlay/tmp/*
cp -a /tmp/* /overlay/tmp/
umount /tmp
[ $? -ne 0 ] && {
umount -l /tmp
}
mount /overlay/tmp/ /tmp
- download and build
cd /root
wget https://github.com/foosel/OctoPrint/archive/1.0.0.zip
unzip 1.0.0.zip
cd OctoPrint-1.0.0
pip install -r requirements.txt
Note: Currently I am only able to get Octoprint 1.0.0 to work
- Now we need to edit a few files to resolve some compatibility issues.
TODO: edit the following file
- Unicode is going to cause problem with Python on Omega2. we have to replace the unicode author name to ascii ( Sorry Gina Häußge )
s/Häußge/H\./g
sed -i 's/Häußge/H\./g' /root/OctoPrint-1.0.0/src/octoprint/util/comm.py
sed -i 's/Häußge/H\./g' /root/OctoPrint-1.0.0/src/octoprint/util/virtual.py
- Omega only have one user and that is root. Octoprint does not let you run as root so we have to suppress that
sed -i 's/exit("You should not run OctoPrint as root!")/pass/g' /root/OctoPrint-1.0.0/src/octoprint/server/__init__.py
- test drive
./run
open up a browser and
Auto start Octoprint at startup
- move OctoPrint to a proper location
mv /root/OctoPrint-1.0.0 /usr/share/OctoPrint
- make symlink to command
ln -s /usr/share/OctoPrint/run /usr/bin/octoprint
edit /etc/rc.local
add the following before exit 0
octoprint &