[MinnowBoard] run continuously from microSD?

Jim Elliott james_m_elliott at yahoo.com
Wed Jul 20 01:26:04 UTC 2016


Gentlemen:
Thank you for your responses and for directing my attention to Debian.  I can now start my own C++ program on the Minnowboard Turbot, without manual intervention, from power up.  I offer these notes:
A procedure to place Debian on a Minnowboard Turbot with UEFI.This procedure is a modification for the Minnowboard Turbot of http://forums.debian.net/viewtopic.php?f=16&t=124417
1) Download Debian and Shell.efi ...1a) On a Linux desktop PC (for example Linux Mint Cinnamon with the Nemo file explorer) web browse to http://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/and download Live ISO:debian-live-8.5.0-amd64-lxde-desktop.iso1b) Download Shell.efi fromhttps://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/If warned that the file is potentially harmful, click KEEP.1c) Take note of where the browser puts the .iso and .efi files, perhaps into a folder named Downloads.
2) Format a microSD as FAT32...2a) On the desktop PC, start the Nemo file explorer2b) Put the microSD into a USB port adapter and plug it into a free USB port.  Expect hot plugging to find it.2c) In Nemo, at the left under Devices look the newly visible line for the microSD. 2d) Right click on that line and select Format.  Select FAT32 and click the Format button.  This takes about 4 seconds.2e) Click OK and close the "USB Stick Formatter" that you invoked through Nemo.
3) Extract the Debian ISO to the microSD.3a) With Nemo, open the Downloads folder, right click on the Debian .iso file just downloaded, and select "Open with Archive Manager".3b) Push "Extract". Then, in the left pane of the window, find the microSD device.  Select Extract.  This takes about 3 minutes.  Ignore the error about "File system does not support symbolic links".  Close the Archive Manager and the window showing the extracted files.
4) Add files to enable UEFI booting...4a) With Nemo, click on the microSD device to view the files just extracted and now resident on the microSD.4b) With the file menu, "create new folder", to make a new folder named EFI (all caps might be important).4c) In a similar way, make a new folder under EFI named BOOT.4d) Copy Shell.efi from Downloads into the new microSD folder /EFI/BOOT.4e) Using a text editor such as gedit, create a new file containing this linelive\vmlinuz initrd=live\initrd.img append boot=live components4f) Use "save as" to put that file on the microSD, root directory, named startup.nsh.
5) Boot Debian on the Minnowboard Turbot from microSD...5a) On the desktop PC, Nemo, right click on the microSD device and select Eject.5b) Remove the USB adapter containing the microSD from the desktop PC.5c) Remove the microSD card from its USB adapter.5d) With Minnowboard power off, orient the microSD card so that the gold contacts face up relative to the Minnowboard.5e) Insert the microSD into its holder on the Minnowboard.  It will click into place.  (Later, you also push to release and remove).5f) Power up the Minnowboard.  Startup takes 80 seconds with reassuring messages as it comes up and with only one anxiety-causing blank screen lasting 11 seconds.
6) Optionally, add your own files to the microSD...6a) Return the microSD to the desktop PC.6b) Using Nemo, add files to the microSD to the root directory or in a new folder of your choice.6c) Move the microSD back to the Minnowboard and reboot.6d) Start menu, Accessories, Disks, click "SD Card Reader".  Under contents, notice the link after "Mounted at" (/lib/live/mount/medium).  Click that link.6e) Locate your files in the file explorer window that pops up.

Opinion - this procedure has these advantages:* Installs a Minnowboard Turbot UEFI-bootable Linux on microSD using only three common GUI-based utilities:** a web browser to download two files** a file explorer to format FAT32 and place files on a microSD** a text editor to put one line in one file on the microSD----  No need for UNetbootin, gparted, Disks, "Create Bootable USB stick", or to "remaster" an .ISO.  * Boots to the LXDE desktop on powerup without manual intervention.* Add your own files without .ISO compression, "remaster", or squashfs utilities (although I describe that next).* Preliminary conclusion:  if you start an application that does not require disk I/O after loading, you can actually unplug the microSD to verify that Linux isn't doing microSD writes behind the scenes.* Preliminary conclusion:  no need to change the UEFI boot order (which I suspect of being faulty - sometimes forgets the boot order you set&save).
and at least one disadvantage:* because this is a "live cd", changes made to files on the Minnowboard are not actually written to the microSD and do not survive reboot.
UNIX systems have a root directory at the top of a file system which is mounted and available after booting.  With "Live CD" distributions such as the one used here, that file system is compressed and placed on the microSD in /live/filesystem.squashfs.  This becomes the file system that you see on the Minnowboard when invoking file explorer utilities or invoking console commands like ls.  What follows is a procedure for adding your own files to this (squashed) file system on the microSD.
7) Optionally, add your own files to the squashed file system...7a) If not already present, on your desktop PC, use Start, Administration, Software Manager, to install squashfs-tools.7b) With the microSD back in your desktop PC, copy /live/filesystem.squashfs from the microSD to a folder of your choice, perhaps unsq. 7c) Start a terminal window, log in as root, and enterunsquashfs  -f -d unsq/ filesystem.squashfsIt will take about one minute to unsquash the file system into a directory named unsq.
--- you may repeat from here down ---
7d) Make modifications of your choice to the files in the unsq directory.  Because the unsquashed files are owned by root, I find it convenient to use Nemo, "Open as root" to gain write permissions.7e) Again from the terminal window enter (skip this the first time or just ignore the error) rm resquashedfs mksquashfs unsq/ resquashedfsThis takes about 4 minutes.The new file resquashedfs contains your modified file system and needs to be moved to the microSD and named filesystem.squashfs, so...7f) In Nemo, accessing the microSD, delete live/filesystem.squashfs.7g) Copy and paste resquashedfs into the microSD in the live directory.  This takes about two minutes even though the Nemo progress bar immediately shows 90% completion.7h) Rename requashedfs to filesystem.squashfs7i) As before, eject the microSD with Nemo, insert into the Minnowboard, and reboot.You may make repeated changes to the Minnowboard file system by repeating steps 7d onward.
8) Optionally, start your program in a terminal window after Minnowboard reboot8a) At step 7d, place an executable file, perhaps named hello_world in /usr/local/bin (which is in the PATH of this Linux build)8b) Also append this line at lxterminal -e /usr/local/bin/hello_worldto/etc/xdg/lxsession/LXDE/autostart
 

    On Friday, July 15, 2016 4:10 PM, John 'Warthog9' Hawley <warthog9 at eaglescrag.net> wrote:
 

 Some of the rescue CDs have a good way to run straight out of RAM, worth
looking into spinning a custom one of those (knoppix comes to mind as
having done that), not sure what's available these days but it's
completely doable.  If your stuff is small enough you could run it out
of the initrd potentially.

- John

On 07/15/2016 02:32 PM, Jim Elliott wrote:
> I have an application that will run continuously, interrupted only by a
> power failure from the electric utility.  I would be interested in
> suggestions on how to meet these goals:
> * OS and my executable resident on the microSD
> * both USB ports on the Minnowboard (Turbot) are taken, they cannot hold
> a USB flash drive containing my executable.
> * at power up the OS and my application start without manual intervention.
> * no writes to the microSD after initialization - my application does
> not perform any I/O to the storage device after initialization.
> * at powerup, initialization can be slow - no problem if it takes two
> minutes or so.
> 
> Thanks for all ideas!
> Jim
> 
> 
> 
> _______________________________________________
> elinux-MinnowBoard mailing list
> elinux-MinnowBoard at lists.elinux.org
> http://lists.elinux.org/mailman/listinfo/elinux-minnowboard
> 



  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.elinux.org/pipermail/elinux-minnowboard/attachments/20160720/40d8cd81/attachment-0001.html>


More information about the elinux-MinnowBoard mailing list