question

matthiasu avatar image
matthiasu asked

Here's a script to build a hybrid Debian/Venus image, booting the current kernel

https://github.com/M-o-a-T/moat-victron/blob/main/scripts/

My "build_image" script creates a hybrid image that's capable of booting both Debian and Venus from the same file system, using btrfs and subvolumes.

The script does this:

  • create a boot partition (with the Debian kernel)
  • create a root supervolume
  • copy Debian to a subvolume
  • copy Venus to another subvolume
  • reflink-copy the kernel modules from Debian to Venus
  • create an empty subvolume, for /data
  • modify /etc/fstab appropriately
  • tag the Venus subvolume as default

Usage:

  • download a Debian for your Raspberry Pi from https://raspi.debian.net/
  • download a Venus image (*.wic.gz) from https://updates.victronenergy.com/feeds/venus/release/images/raspberrypi2/
  • Uncompress both images
  • Run
    build_image deb.img venus.wic /dev/sdX
    where /dev/sdX is an SD card of at least 4GB. The card's previous content will be deleted without warning, so be careful.
  • plug into your Raspberry Pi and boot it. You're in what looks like a standard Venus installation.
  • Run the "setupdeb.sh" script.

Mostly-seamlessly running a normal Debian program from within Venus can be done with a helper, named the same as the target program:

#!/bin/sh

exec env PATH=/opt/debian/bin LD_LIBRARY_PATH=/opt/debian/lib/aarch64-linux-gnu/ \
    /opt/debian/bin/$(basename $0) \
    "$@"

Of course, you also can use chroot; venus and /data can easily be bind-mounted to /opt/debian/whereever, as required. "setupdeb.sh" installs this helper as /usr/local/bin/btrfs because, surprise, there is no btrfs-progs package for Venus.

To switch boot targets, a companion script https://github.com/M-o-a-T/moat-victron/blob/main/scripts/boot_image simply mounts the supervolume and changes the default.

There's also a script to fetch a new Venus image and set it up just right; however that hasn't been tested at all.

All of the above is probably slightly buggy, because I didn't actually run the current incarnation yet (too busy setting up my solar systems ā€¦). Bug reports are always welcome and will be acted upon.

Venus OS
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

1 Answer
johanndo avatar image
johanndo answered Ā·

Great, thanks. Will try this, makes installing things easier I guess using apt and the debian repository instead of opkg.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources