CloudFlash is a micro SD card adapter with built-in wireless LAN. It is an SD card that the storage part of Eye-Fi and FlashAir is sold separately. Since Linux is running inside, you can play various things.
Suddenly, I wanted to run a Python script on CloudFlash and automatically upload the captured image to Flickr etc., so I decided to try Python cross compile first.
This is the memorandum.
sorcery codebench or launchpad Get the toolchain from -arm-embedded). Here, I used the latest Sourcery CodeBench Lite 2014.05-29.
Download the Python source code and the patch for cross compile on a suitable Linux PC. The patch is provided by Paul Gibson, a bibliography. Thanks!
$ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
$ wget http://randomsplat.com/wp-content/uploads/2011/10/Python-2.7.2-xcompile.patch
First, build Python for the host. The hostpython and hostpgen generated here will be needed for later cross-compilation.
$ tar xjf Python-2.7.2.tar.bz2
$ cd Python-2.7.2
$ ./configure
$ make python Parser/pgen
$ mv python hostpython
$ mv Parser/pgen hostpgen
$ make distclean
Apply the patch and reconfigure for arm926ej-s.
$ patch -p1 < ../Python-2.7.2-xcompile.patch
$ CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ AR=arm-none-linux-gnueabi-ar RANLIB=arm-none-linux-gnueabi-ranlib BASECFLAGS=-mcpu=arm926ej-s ./configure --host=arm-none-linux --build=x86_64-linux-gnu --prefix=/python
Make. I get a warning like unrecognized format function type [-W format =], but I don't care.
$ make HOSTPYTHON=./hostpython HOSTPGEN=./hostpgen
Collect the files to be copied to the rootfs of the target (CloudFlash) in _install.
$ make install HOSTPYTHON=./hostpython CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes prefix=~/Python-2.7.2/_install
Delete unnecessary information by stripping to make it as small as possible.
$ cp -rf _install _install_stripped
$ for SO in _install_stripped/lib/python2.7/lib-dynload/*.so; do arm-none-linux-gnueabi-strip ${SO}; done
$ arm-none-linux-gnueabi-strip _install_stripped/bin/python2.7
$ rm _install_stripped/bin/python
$ ln -s python2.7 _install_stripped/bin/python
cd / mnt / sd / _install_stripped / bin
and ./python
etc., you can see that it works well.
When I telnet to CloudFlash and take a peek, the startup process is as follows.
/etc/inittab
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquel
null::sysinit:/bin/mount -o remount,rw /
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mount -t sysfs sysfs /sys
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
console::sysinit:/etc/init.d/rcS
# Start an "askfirst" shell on the console (whatever that may be)
#::askfirst:-/bin/ash
#ttyS0::respawn:-/bin/ash #enter shell automatically
ttyS0::askfirst:-/bin/ash #enter shell needs enter
/etc/init.d/rcS(Excerpt)
#cp /mtd/dnsd.conf to /etc
cp /mnt/mtd/config/dnsd.conf /etc
#cp /mtd/udhcpd.conf to /etc
cp /mnt/mtd/config/udhcpd.conf /etc
cp /mnt/mtd/config/wsd_backup.conf /etc/wsd_backup.conf
#a2&
# autorun.sh from sd in case need to perform some test mode
if [ -f /mnt/sd/autorun.sh ]
then
echo "run autorun.sh"
sleep 1
chmod 777 /mnt/sd/autorun.sh
/mnt/sd/autorun.sh&
fi
echo "rcS done"
If you put ʻautorun.sh` in the root of the SD card, you can do various things.
Recommended Posts