Pages

Thursday, May 2, 2013

Time to SMILE Again?

As mentioned in a previous post, recently produced SMILEs had a software defect in their boot configuration. The boot parameters were wrong, which prevented re-flashing of the NAND with an SD card or USB drive. This was the cause of my sorrows.

Now for some good news. You can ship your unit to Global Scale Technologies, they will fix it and ship it back to you. More information is available at the community page.

Once I get my unit fixed, activity in this blog will resume.

Friday, April 19, 2013

A Problem With the SMILE Production Unit Prevents Re-Flashing

As promised in the last post, here's an update on the re-flashing issue. The SMILE, as currently manufactured by Global Scale Technologies, has the wrong uboot arguments. This prevents the simple re-flashing from the SD card. I learned about this from David Kordsmeier, who posted a reply to the question on the SMILE Google+ forum:
just got my 1st factory produced version, and low and behold, the uboot bootargs are wrong.  Should be: 
setenv bootargs 'console=ttyS0,115200' 
The fix is easy if you have the jtag box.  I'll post some updates as to what to do for folks who don't have a jtag yet (really everyone needs at least one).  Apologies, and thanks for your patience working with the community to sort out what's going on.
Since I don't have a JTAG box, I am currently stuck. More information when (and if) it becomes available.

Monday, April 15, 2013

Re-Flashing the SMILE Plug - Does It Really Work?

Ouch!

I half-bricked my SMILE. Here's what happened: I edited the /etc/rc.conf file (which has the list of the daemons to be run at boot time). Accidentally, I deleted the wrong daemon, and voila - upon reboot, I was not able to connect. The wireless network was down. The Ethernet ports did not connect to the network. There was no way to ssh into the plug. I probably deleted the network daemon. The unit works, and I get the smiling "green grin" - but I just can't access the unit. And since I don't have a UART/JTAG cable or box, I am not able to attach a console to the box.

I found out the instructions for re-flashing the SMILE. They are not too complicated:
  • Format a micro SD card (or a USB drive) so that the first partition will be an ext3 file system. 
  • Download the root file system image (rootfs.img). There are currently two versions available online:
  • Copy the rootfs.img file of your choice to the micro SD card.
  • Turn off the SMILE.
  • Insert the SD card.
  • Turn on the SMILE.
  • The SMILE's boot code checks the micro-SD card. If it finds a rootfs.img in the first partition, it uses it to flash the internal NAND flash memory. Otherwise, it checks if a USB drive is mounted, and again looks for a rootfs.img file to be used for flashing.
  • During flashing, the unit's "eyes" blink. The process can take more than a minute.
  • Upon successful flashing, the rootfs.img file is renamed to rootfs.img.flashed. If the flash was not successful, the file is renamed to rootfs.img.failed.
  • If the flash was successful, the unit reboots with the new file system.
My source for the re-flashing instructions are taken from here (see Initramfs procedure) and here

I followed these procedures accurately, but the unit failed to flash the internal NAND flash. I tried with several different micro-SD cards as well as with various USB drives. In all cases, the file is renamed to rootfs.img.failed. The fact that the file is renamed means that the unit is able to access the card as well as the file system. But I have no clue why the flash fails.

I sent an email to the support folks at Global Scale Technologies, the manufacturer of the plug computer (support@globalscaletechnologies.com) about a week ago, but there was no response. Not a very good sign.

I also posted a query on the SMILE community page on Google Plus, and PARC's David Kordsmeier is checking into the matter. Another customer also complained of a similar issue.

We will update the blog if - and when - we find new information.

Monday, April 8, 2013

Password-Protect Your SMILE Plug

When you turn on your SMILE, anyone can connect to its wireless network and then login as root. Totally insecure! So it's a good idea to change root's password. How? The command is "passwd". After ssh'ing to the plug, just type passwd, enter (and re-enter) the new password, and you're done.

root@SMILEplug:~# passwd
Enter new UNIX password: <password>
Retype new UNIX password: 
<password>
passwd: password updated successfully
root@SMILEplug:~#


Saturday, April 6, 2013

The SMILE as a Content Web Server

I wanted to configure the SMILE to serve static content from the micro-SD card. It was fairly simple.

First, I installed nginx on the SMILE. I then mounted the SD card.

Finally, I had to configure nginx to serve content from the card (mounted as /media/sdcard), which is what this post is about.

The main configuration file is /etc/nginx/nginx.conf. First, we'll change the port on which nginx listens. The default port is 80, but this is already being used by the SMILE software. We can disable the SMILE software, and we'll talk about it in an upcomign post. But in the meantime, let's just change the nginx port. So we'll change the following line:
listen       80;
into
listen       8080;
The next change will be the location of the documents. The default root directory for the content is /usr/share/nginx/html. We have two options here. Either edit the nginx.conf file to change the directory, or add a soft link from /usr/share/nginx/html to /media/sdcard. For the first method, you'll need to change the nginx.conf line
root   /usr/share/nginx/html;
into
root   /media/sdcard;
The second method involves first deleting (or renaming) the /usr/share/nginx/html directory, then adding a soft link instead. Here's how to about this path:
cd /usr/share/nginx/
mv html html.orig
ln -s /media/sdcard/ html
That's it! You can now go to http://10.1.0.1:8080 (assuming you're connected wirelessly to the SMILE), and assuming you have an index.html (or index.htm) in your SD card's top directory, you should see it now in your browser. If yo're getting a 403 error, it means you probably don't have an index.html file on the SD card.

Running nginx is simple - you basically type nginx at the shell prompt:
root@SMILEplug:~# nginx
In case nginx is already running, you can issue the following command  to reload the configuration file:

root@SMILEplug:~# nginx -s reload

Installing nginx

nginx is a light, super-fast web server. To install it on SMILE plug, sign in as root, and simply install the nginx package using pacman. I noticed that a package database sync was required first, so run a sync (pacman -Sy) first. Make sure your plug is connected to the web.


root@SMILEplug:/etc# pacman -Sy
:: Synchronizing package databases...
 core                                                                  45.4 KiB  11.9K/s 00:04 [#######################################################] 100%
 extra                                                                507.3 KiB  27.4K/s 00:18 [#######################################################] 100%
 community                                                            510.7 KiB  26.6K/s 00:19 [#######################################################] 100%
 alarm                                                                  8.3 KiB   227K/s 00:00 [#######################################################] 100%
 aur                                                                   19.9 KiB  4.99K/s 00:04 [#######################################################] 100%
root@SMILEplug:/etc# pacman -S nginx
resolving dependencies...
looking for inter-conflicts...

Targets (3): geoip-1.4.8-2  geoip-database-20130206-1  nginx-1.2.7-5

Total Download Size:    0.97 MiB
Total Installed Size:   3.72 MiB


Proceed with installation? [Y/n] y
:: Retrieving packages from extra...
 geoip-database-20130206-1-any                                        679.3 KiB  26.1K/s 00:26 [#######################################################] 100%
:: Retrieving packages from community...
 nginx-1.2.7-5-armv7h                                                 311.0 KiB  21.6K/s 00:14 [#######################################################] 100%
(3/3) checking package integrity                                                               [#######################################################] 100%
(3/3) loading package files                                                                    [#######################################################] 100%
(3/3) checking for file conflicts                                                              [#######################################################] 100%
(3/3) checking available disk space                                                            [#######################################################] 100%
(1/3) installing geoip-database                                                                [#######################################################] 100%
(2/3) installing geoip                                                                         [#######################################################] 100%
(3/3) installing nginx                                                                         [#######################################################] 100%
root@SMILEplug:/etc# 



Mounting the Micro-SD Card

So you want to see the files on the SD card - or rather, the micro-SD card - that you just inserted into the SMILE. It's quite easy:
  1. After inserting the card into the slot (which is just next to the power switch), take a look at the last few kernel messages. You can use the dmesg command for that. The important thing is finding out the device name associated with the SD card. In our case, the device is mmcblk0, mmcblk1p1, or the like. You are likely to get similar results. Note that our device was a 2 GB card.

    root@SMILEplug:~# dmesg
    ...
    mmc0: new high speed SD card at address 2711
    mmcblk0: mmc0:2711 SD02G 1.87 GiB
    mmcblk0:
  2. Next, we'll mount the device. We use vfat as the file system type since this SD card was a FAT32 device, the msot popular format for SD card and USB memory sticks.

    root@SMILEplug:~# mkdir /media/sdcard (only needed if the sdcard directory does not exist)

    root@SMILEplug:~# mount -t vfat /dev/mmcblk0 /media/sdcard/
Finally, to verify that you can see the card's contents:

root@SMILEplug:~#
ls /media/sdcard