Translate

Friday, May 11, 2018

Using PiBackery - my FAQ

PiBackery is a nice tool to prepare SD cards for the Raspberry Pi.
One of the annoying problems to work with Raspberry in embedded world, is the need to have it connected to a wired network, monitor HDMI and keyboard for the first initialization.

With PiBackery is not necessary anymore to do so.
Is possible to set up a starting image on the SD card capable to be connected to a WiFi network, thus is enough after the first boot, to use SSH to login in the Raspberry and complete the installation.

The tools is great but there are some pitfalls, tricks, things that is better to know.
I'm collecting them here.

I strongly suggest to read first the documentation about it on the official website.
This document is kept updated.  Expect modifications.

There is one for Linux ?

At the moment you need to compile the source for Linux.
Ready on the shelf versions are for Windows and Mac OS.

Download the source code from here via git.

What image it uses ?

Usually expect to use the latest officially release image for the Raspberry Pi.

What is a block ?

A block is a setting of functionality that can be added to the SD card image under preparation.

I can't connect via SSH

Depending what image is used, SSH can be enabled or disabled by default.
Is always better to force the use of SSH.  It is possible though the block to enable the SSH server is not in PiBackery available blocks (see below)

How I can add a SSH enable block ?

Here some generic guidelines to add the block.
I'm assuming you know how to create files and directories in your environment.
A PiBakery block is basically a directory with two files :
  • a json file
  • a script file

To add a new block to enable the ssh :
  • locate the pibakery-blocks directory
  • create a new directory called sshconfig
  • in the new directory create two files :
    • sshconfig.json
    • sshconfig.sh
  • In the sshconfig.json file copy :

    {
       "name": "sshconfig",
       "text": "%1 SSH server",
       "script": "sshconfig.sh",
       "args": [{
          "type": "menu",
          "options": ["Enable", "Disable"]
          }],
       "network": false,
       "continue": true,
       "type": "setting",
       "category":"setting",
       "supportedOperatingSystems": [
          "raspbian-pibakery.img",
          "raspbian-lite-pibakery.img"
    ],
    "shortDescription":"Enable or disable SSH server",
    "longDescription":"By default Raspbian Stretch has the SSH access disabled. In order to use SSH this must be enabled."
    }
  • In the sshconfig.sh copy :
    #!/bin/bash
    if [ "$1" == "Enable" ]
    then
    raspi-config nonint do_ssh 0
    else
    raspi-config nonint do_ssh 1
    fi
  •  
  • Edit the file info.json and add a line with the name of the added block, in this case :

    "sshconfig.json",

    Be sure to add the comma in the end if the line is placed before the last one.
    Only the last line of info.json must end WITHOUT comma.
  • Start the pibackery and you should see the new block available under the category set (in the example : settings)



No comments:

Post a Comment