When working with photonvision and without a romi in front of me, I decided to give qemu a try.
It works, but it is very slow.
See the 'boot' script provided for booting.
- system reboots twice before staying up
#!/bin/sh | |
# | |
# upstream: git://gist.github.com/1019125.git | |
VERBOSITY=0 | |
LOCK="" | |
CR=" | |
" | |
error() { echo "$@" 1>&2; } |
This is just a wrapper around python subprocess that I like to use. It originated during cloud-init development.
Some things that I like about it:
- SubpResult prints well.
- times how long subpocesses take, that is available in the SubpResult.
- takes a timeout and a signal to send to the subprocess. The python standard library will only ever send SIGKILL which does not give the process time to cleanup.
#!/usr/bin/python | |
import distro_info | |
def get_ubuntu_info(date=None): | |
# this returns a sorted list of dicts | |
# each dict has information about an ubuntu release. | |
# Notably absent is any date information (release or eol) | |
# its harder than you'd like to get at data via the distro_info library |
#!/bin/bash | |
# just an example using inotifywait. the 'process' function basically reads from | |
# the output of inotifywait and then when it is found what it is after it will kill the | |
# inotifywait process. | |
# | |
# used this to hack a dpkg postinst script that wasnt yet installed and enable some debugging | |
# in it before it was run. | |
LAUNCH_PID="" | |
LOG="/run/${0##*/}.log" | |
set -f |
If you are playing around with qemu, sometimes it is useful to have a kernel and initrd easily available to play with. Cirros provides kernel and initramfs that can be used for this purpose.
This init
script here provides a initramfs /init
that will do nothing
but write the kernel command line and then power the system off. You can
adjust it to your needs.
The get-krd
script will:
backdoor-image can be used to easily add user with passwordless sudo access to a image or a root filesystem.
Operating on an image requires the 'mount-image-callback' tool from
cloud-utils. That can be installed on ubuntu via apt-get install -qy cloud-image-utils
.