Browse Source

Support passing arguments directly to script that runs mender-convert container.

Changelog: Support passing mender-convert arguments to docker-mender-convert directly

Signed-off-by: Eystein Måløy Stenberg <eystein.maloy.stenberg@northern.tech>
1.1.x
Eystein Måløy Stenberg 6 years ago
parent
commit
b6be19db20
  1. 38
      docker/README.md
  2. 4
      docker/docker-mender-convert

38
docker/README.md

@ -7,7 +7,7 @@ and their version and name vary between Linux distributions.
To make using mender-convert easier, a reference setup using a Ubuntu 18.04 Docker container To make using mender-convert easier, a reference setup using a Ubuntu 18.04 Docker container
is provided. is provided.
You need to [install Docker Engine CE](https://docs.docker.com/install) to use this environment. You need to [install Docker Engine](https://docs.docker.com/install) to use this environment.
## Build the mender-convert container image ## Build the mender-convert container image
@ -18,7 +18,7 @@ copy this directory to your workstation and change the current directory to it.
Then run Then run
```bash ```bash
./build.sh ./docker-build
``` ```
This will create a container image you can use to run mender-convert. This will create a container image you can use to run mender-convert.
@ -26,52 +26,44 @@ This will create a container image you can use to run mender-convert.
## Use the mender-convert container image ## Use the mender-convert container image
Create a directory `input` under the directory where you copied these files (`build.sh`, `run.sh`, etc.): Create a directory `input` under the directory where you copied these files (`docker-build`, `docker-mender-convert`, etc.):
```bash ```bash
mkdir input mkdir input
``` ```
Put your raw disk image into `input`, e.g. `input/2018-10-09-raspbian-stretch.img`. Then put your raw disk image into `input`, e.g.
Then put a Mender client binary compiled for your device into `input/mender-1.6.0-arm-linux-gnueabihf-gcc`.
See [the Mender documentation on how to cross-compile the Mender client for your device](https://docs.mender.io/development/client-configuration/cross-compiling).
After you have built or pulled the mender-convert container image,
you can run it with
```bash ```bash
./run.sh mv ~/Downloads/2018-11-13-raspbian-stretch.img input/2018-11-13-raspbian-stretch.img
``` ```
This will drop you into a shell environment (interactive mode). You can run mender-convert from inside the container with your desired options, e.g.
Change to the mender-convert directory:
```bash
cd /mender-convert
```
You can now run mender-convert with your desired options, e.g.
```bash ```bash
DEVICE_TYPE="raspberrypi3" DEVICE_TYPE="raspberrypi3"
RAW_DISK_IMAGE="input/2018-10-09-raspbian-stretch.img" RAW_DISK_IMAGE="input/2018-11-13-raspbian-stretch.img"
MENDER_CLIENT="input/mender-1.6.0-arm-linux-gnueabihf-gcc"
ARTIFACT_NAME="2018-10-09-raspbian-stretch" ARTIFACT_NAME="2018-11-13-raspbian-stretch"
MENDER_DISK_IMAGE="2018-10-09-raspbian-stretch.sdimg" MENDER_DISK_IMAGE="2018-11-13-raspbian-stretch.sdimg"
TENANT_TOKEN="<INSERT-TOKEN-FROM Hosted Mender>" TENANT_TOKEN="<INSERT-TOKEN-FROM Hosted Mender>"
./mender-convert from-raw-disk-image \ ./docker-mender-convert from-raw-disk-image \
--raw-disk-image $RAW_DISK_IMAGE \ --raw-disk-image $RAW_DISK_IMAGE \
--mender-disk-image $MENDER_DISK_IMAGE \ --mender-disk-image $MENDER_DISK_IMAGE \
--device-type $DEVICE_TYPE \ --device-type $DEVICE_TYPE \
--mender-client $MENDER_CLIENT \ --mender-client /mender \
--artifact-name $ARTIFACT_NAME \ --artifact-name $ARTIFACT_NAME \
--bootloader-toolchain arm-linux-gnueabihf \ --bootloader-toolchain arm-linux-gnueabihf \
--server-url "https://hosted.mender.io" \ --server-url "https://hosted.mender.io" \
--tenant-token $TENANT_TOKEN --tenant-token $TENANT_TOKEN
``` ```
Note that the default Mender client is the latest stable and cross-compiled for generic ARM boards,
which should work well in most cases. If you would like to use a different Mender client,
place it in `inputs` and adjust the `--mender-client` argument.
Conversion will take 10-15 minutes, depending on your storage and resources available. Conversion will take 10-15 minutes, depending on your storage and resources available.
You can watch `output/build.log` for progress and diagnostics information. You can watch `output/build.log` for progress and diagnostics information.

4
docker/docker-mender-convert

@ -9,8 +9,8 @@ OUTPUT_DIR="$(pwd)/output"
mkdir -p $OUTPUT_DIR mkdir -p $OUTPUT_DIR
docker run -it \ docker run \
--mount type=bind,source=$INPUT_DIR,target=/mender-convert/input,readonly \ --mount type=bind,source=$INPUT_DIR,target=/mender-convert/input,readonly \
--mount type=bind,source=$OUTPUT_DIR,target=/mender-convert/output \ --mount type=bind,source=$OUTPUT_DIR,target=/mender-convert/output \
--privileged=true \ --privileged=true \
$IMAGE_NAME $IMAGE_NAME "$@"

Loading…
Cancel
Save