Intel Edison: USB Storage Sled

I’ve been spending the last year or so playing with the Intel Arduino products – Namely the Intel Galileo and the Intel Edison. One of my projects the last few months has been Making a LinuxFromScratch Linux Kernel with full build tools, Xwindows, and QEMU running WinXP SP3. Included in this build is a XWindows software FrameBuffer w/ VNC capability; that way I can run a networked gui and do some GUI type work.

Chrome x86 running on Edison under XWindows
Chrome x86 running on Edison under XWindows

The Edison is cool because it’s just powerful enough to run WinXP under QEMU without any software emulation. While I wouldn’t call the Edision a speed demon – it should be good enough to allow printer drivers to function. The onboard storage for the Edison isn’t really big enough to run WinXP from the eMMC flash; so I opted to run a SSD attached to the USB2.0 port of the Edison. Edison runs as the “master”. The end goal of providing “always on” scanner and printer driver capabilities for my old HP all-in-one color laser and the ULS-25E laser cutter.

Windows XP SP3 running on Intel Edison
Windows XP SP3 running on Intel Edison

I also wanted to run a rotational drive .. to act as a swap space for both Linux and for the Winblows PageTable. To do this; I built a Microdrive FLEX to 44pin 2.5″ IDE adapter board and attached it to the Edison via a usb->ATA adapter. I verified all of this works with a usb hub.

With the concept proven; I set about generating a Intel Edison USB Storage Sled. This PCB provides power to the Edision and then connects up a 4port USB hub. This hub then serves the USB->SATA->mPCIe->Intel SSD, a USB->PATA->flexIDE Microdrive, and an extra device port. I set about putting the Sled in a SparkFun Edison Block compatible form factor early in the design phase. Clearly this much stuff on one board prevents me from adhering to the tiny formfactor; so I grew it in the X direction to 4.5″ wide and about 2.1″ tall. This board provides all the power to run the SSD and PATA interfaces. The board is 4 layers; due to USB2.0 routing requirements / impedance matching.

Why the Sparkfun Edison Block formfactor? Well simply put; I wanted to be able to expand the “system” with more features I don’t forsee at the moment. Example: I do not currently need an SDIO card on my Sled – honestly; I’m lazy and don’t want to route the pins. But; if later I need it – I can just buy Sparkfun’s Block and add it to the system.

I’m requesting comments / suggestions / peer reviews for the design; as a result I’m posting it here. The first 3pages of schematics are Licensed to you as Derivative works of Intel and Sparkfun. The last 3 pages and the PCB Layout are currently ALL RIGHTS RESERVED Copyright 2015 by John Zitterkopf. ATM; I’m thinking I’d release the final design under a TAPR/NCL license… but I haven’t committed to that yet.
Prototype Schematics / PCB Layout

In addition to the features above; I’ve designed in some USB Muxes to aid switching the Edison into Device or Host mode (similar to the Intel Edison Arduino board). I’ve also included the Lipo Battery charging circuit to provide a limited UPS type capability to the design incase of small power outages due to lightning or what not. Lastly; I added an I2C eeprom which can be programmed by the Edison for the USB to SATA bridge chip.

Update 8/28/2015:

Here are some pictures of the finished prototype:
Secondary/Edison Side

Primary/mSATA side

Feel free to leave a comment here (which will be reviewed by a human prior to posting) or provide comments in the various threads / project logs below:

Xorg server on video-less NAS

Random notes while trying to compile Xorg (X-Windows) on a ARM NAS. Following recipe at:

Beyond Linux From Scratch (Version 2014-11-19)

The NAS box has no video harware; so I want a software rasterizer (swrast).

Step MesaLib-10.3.3 :

No video hardware won’t allow the default configure to work. Tried:

./autogen.sh CFLAGS="-O2" CXXFLAGS="-O2" --prefix=$XORG_PREFIX \
--sysconfdir=/etc --enable-texture-float --enable-gbm \
--enable-glx-tls --with-egl-platforms="x11" \
--with-gallium-drivers="swrast,svga" --enable-sysfs \
--with-dri-drivers=swrast --enable-osmesa --enable-xa \
--enable-gbm

I think I also had to go in a remove all i815, i865 referenced in configure.ac. This was done to avoid dependency on intel_drm which wouldn’t compile or be installed on my box.

Step Xorg-Server-1.16.2 :

Default configure options wouldn’t allow the server to compile. Complained about package ‘gl’ and ‘dri’ missing… likely because of the Mesa lib hoops I had to jump thru. The following allows ./configure to pass… make is in progress:

./configure $XORG_CONFIG --with-xkb-output=/var/lib/xkb \
--enable-dmx --enable-suid-wrapper --enable-install-setuid \
--disable-glx  --enable-xvfb --disable-dri

Had to patch os/log.c as my NAS’ GCC was too old.

End goal is to boot a minimal windows manager so I can run google Chrome browser and Google Cloudprint. Also as a learning for doing this on an Intel Edison board which also lacks video.

EOL

iPhone conversion script for IPCam security videos

iPhones are rather picky about supporting non-Quicktime video files… as a result my EdiMax IC-7000PTn ip security camera’s motion notification emails weren’t viewable on the device… instead; I’d have to try and remember the external url to the camera and view live.  After spending a weekend in Atlantic City for my Mom’s 60th b’day… and getting these useless notifications; I decided to do something about it.

At first; I tried to hack the security camera’s firmware… To complicated with to much risk; as EdiMax doesn’t provide sourcecode for the device… and none seems to have spend a large amount of time on this specific model.

Since I have my IP camera set to dump security motion files onto my LG NAS via FTP, I figured I might as well use the ARM cpu to convert these files using ffmpeg 0.11 and the x264 library to convert the files to a iPhone friendly format. It was a trick to install the x264 library; so please see this post for notes on how I did it. I have root /ssh access to the NAS; unsure if the stock firmware has this so see this post for pointers to the firmware I used.  The NAS should have the other prerequisites already installed, but in-case I’ll try to list them all here:

I’ve decided to release the conversion script to the Interwebs via the MIT License for anyone to use. I’d appreciate a talkback/”thank you comment” below if you’ve used it. You can download the script here:

iPhone BASH script

The script is fairly well commented so you should be able to modify it as needed. For the most part; the implementation specific variables are near the top of the script. The Must Change are as follows:

Variable Description/Usage
sourcelocation Location of the source videos to convert; typically a “dropbox” ftp-ed in from your camera
backlocation Backup location of the videos after conversion.
original files are saved for later review
sourceext file extention for the source videos.
Used to detect new files from “old”.
conversionext file extention for the converted videos.
Almost always “mp4” as to be compatible with iPhone.
extcamurl External URL for your IP camera.
Can Specify :port in url for non-80 applications.
Typically a dynamic dns service.
intcamurl Internal URL for your IP camera.
Can Specify :port in url for non-80 applications.
Used when your inside your home’s network.
Other interesting variables – change may be required
ffmpeg FileSystem location for the ffmpeg binary.
Use which ffmpeg to find it.
ffopts holds ffmpeg commandline options for trans-coding to iPhone format.
Could theoreticly be used to trans-code to other smartphone formats.
qtf FileSystem location for the qt-faststart binary.
Used to reverse Quicktime(iPhone) metadata so video is played immediately instead of downloading.
Use which qt-faststart to find it.
uue FileSystem location for the uuencode binary.
Used to base64 encode the video files for MIME attachment.
Use which uuencode to find it.
verbose Set to 0 to keep emails near 1screen on iPhone.
MAILTO if non-root or non LG NAS; you may need to hard code this to the destination email address to send the notification to
SMTP_AUTH if non-root or non LG NAS; you may need to hard code this ON for smtp authorization
SMTP_USER if non-root or non LG NAS; you may need to hard code this a username for smtp authorization
This var is near the end of script
SMTP_PASS if non-root or non LG NAS; you may need to hard code this a password for smtp authorization
This var is near the end of script
sourceage number of days the converted files will remain in sourcelocation
backage number of days the orginal files will remain in backlocation

The script is designed to be run as root via crontab. The Author runs it every minute during daylight hours- this may change when/if he gets additional cameras with night vision. The current version of the script is designed to ensure no other encodings are running – ie more than one instance of iPhone.sh via job control (pgrep). The original video files are backed up to a specific folder and the script makes sure that directory exists.

When sending email using sSMTP; the script will timeout after 90seconds and kill the sSMTP app. You may want to increase this time if you have long videos or a slow Internet connection.

That’s about it… of course, YMMV – but this works very well on my systems and iPhone4. I can get multiple video attachments in a single email; each viewable on my iPhone from the email message.

As an example; here’s a screenshot of the email received on an iPhone4:
Example Email as seen on iPhone4

V1.1 improvements include a “backup” retiring system thanks to MikeS (a reporter at Hackaday.com) and Hackaday commenter gerphy. Their input included the find commands with some extra sauce to include variables for sourceage and backage.

Feedback is welcome – but all comments are screened by myself to prevent comment “spam”.

Compiling x264 for arm926ej-s in the LG NAS

Trying to compile the x264 library (x264-snapshot-20120805-2245-stable)  for the ARM926 in my LG NAS. Running ./configure seems to give a binary which won’t link with ffmpeg. Config.log in ffmpeg gives the following errors:

/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d26′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d22′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d2′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d20′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d24′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d0′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `q1′
collect2: ld returned 1 exit status
ERROR: libx264 not found

Here’s some random notes I used to make it work:

The .configure for x264 seems to default to cortex9 w/ Neon FPU… not present in my LGNAS. Run configure with the following options:

./configure –disable-neon –enable-gpl  –prefix=/usr –enable-static –enable-shared  –disable-asm 

As a result I hand edited the config.mak as follows:

ARCH=ARM
MYCPU=arm926ej-s
SYS=LINUX
CC=gcc
CFLAGS=-Wshadow -O3 -fno-fast-math -Wall -I. -I$(SRCPATH) -std=gnu99 -mcpu=${MYCPU} -mtune=${MYCPU} -fPIC -fomit-frame-pointer -fno-tree-vectorize

Where did I get arm926ej-s ? cat /proc/cpuinfo
According to this post; the LGNAS CPU (Marvell “Kirkwood”) does not have VFP support (would be listed as vfp under “Features” in cpuinfo) therefore do not specify a -mfpu= in the CFLAGS.

Do ‘make’; do ‘make install-lib-shared’.

In ffmpeg; pass the following configure command:

./configure –enable-gpl –enable-libx264 –enable-libfaac –enable-nonfree –enable-libxvid –prefix=/usr –disable-stripping –disable-armv6 –disable-altivec –disable-vis –enable-shared –disable-static

Did the same edit to ffmpeg’s config.mak as done in x264 config.mak.

Notes: Enabling NTFS on LG NAS ( N2B1 )

Jotting down some Notes for enabling the LG N2B1 BluRay NAS to read/write NTFS partitioned USB drives using new firmware and the NTFS-3G package.

  1. Flash new N2B1 firmware to enable SSH server so one can get access to the command prompt on the device:
    Tantalus’ N2B1 Firmware
    Author used N2R1 2569t
  2. Enable SSH in the web console and login into the NAS device using a SSH Client.
  3. login as root . See FAQ
  4. if virgin use of apt-get; initialize the repositories using:
    apt-get update
  5. use apt-get to install gcc compiler.
    apt-get install build-essential
  6. apt-get will fail to install libc6 library; use workaround here:

    mv /sbin/init /sbin/init.mv
    touch /sbin/init
    chmod 755 /sbin/init
    dpkg –configure libc6
    apt-get update
    mv /sbin/init.mv /sbin/init

    WARNING: If you execute the first command, you have to execute the last command, before you reboot your NAS-Box

  7. repeat apt-get install build-essential
  8. gcc -v to verify gcc compiler has been installed and is working.
  9. download NTFS-3G from Tuxera.  Author used: ntfs-3g-2010.10.2
  10. untar: tar xvf ntfs-3g-2010.10.2.gz
  11. cd ntfs-3g-2010.10.2
  12. ./configure –prefix=/usr/lib to install to the correct directory. on Author’s system; the system autoconfigured to /usr/local which caused problems during make install.
  13. make
  14. make install as root. or sudo make install
  15. you should then be able to to mount NTFS partitions using:

    mount -t ntfs-3g /dev/sdb1 /mnt/ntfs

Many Thanks to forum.NAS-Portal.org for hosting the information necessary to piece this together.