summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo@opensourcefoundries.com>2018-05-22 18:44:06 -0300
committerRicardo Salveti <ricardo@opensourcefoundries.com>2018-05-23 18:15:07 -0300
commit23824faa1553ddc06f4d098b1a0510fa3f220a74 (patch)
tree1a8fc942317721c4413a0a8271e3791c58779864 /recipes-core
parent95dee8c07751a7405bf7083bda0b310b78bca3c8 (diff)
initramfs-framework: add specific ostree script for freedom-u540 and qemuriscv64
There is no generic bootloader support for both targets so define a ostree specific initrd script that tries to find out the default ostree hash to be used, as that is not given by default to the kernel. To be reverted once the bootloader is able fetch the ostree hash to use from the storage device. Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/initrdscripts/initramfs-framework/freedom-u540/ostree29
-rw-r--r--recipes-core/initrdscripts/initramfs-framework/qemuriscv64/ostree29
2 files changed, 58 insertions, 0 deletions
diff --git a/recipes-core/initrdscripts/initramfs-framework/freedom-u540/ostree b/recipes-core/initrdscripts/initramfs-framework/freedom-u540/ostree
new file mode 100644
index 0000000..b03ff07
--- /dev/null
+++ b/recipes-core/initrdscripts/initramfs-framework/freedom-u540/ostree
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Copyright (C) 2018 Open Source Foundries Ltd.
+# Licensed on MIT
+
+ostree_enabled() {
+ return 0
+}
+
+ostree_run() {
+ if [ -n "$ROOTFS_DIR" ]; then
+ # HACK: try to boot out of the default ostree target on targets
+ # without bootloader support (no ostree= cmdline argument)
+ if ! grep -q "ostree=" /proc/cmdline; then
+ info "Fetching OSTree target from $ROOTFS_DIR/boot/loader/entries"
+ ostree_entry="$ROOTFS_DIR/boot/loader/entries/ostree-lmp-0.conf"
+ if [ ! -f $ostree_entry ]; then
+ fatal "ERROR: Unable to find default OSTree LMP boot entry $ostree_entry"
+ fi
+ ostree_target=`grep "^options " $ostree_entry | sed -e "s/.*ostree=//g"`
+ cmdline=`cat /proc/cmdline`
+ echo "$cmdline ostree=$ostree_target" > /run/cmdline
+ mount --bind -o ro /run/cmdline /proc/cmdline
+ fi
+ info "Preparing OSTree root at '$ROOTFS_DIR'..."
+ /usr/lib/ostree/ostree-prepare-root $ROOTFS_DIR
+ else
+ debug "No rootfs has been set"
+ fi
+}
diff --git a/recipes-core/initrdscripts/initramfs-framework/qemuriscv64/ostree b/recipes-core/initrdscripts/initramfs-framework/qemuriscv64/ostree
new file mode 100644
index 0000000..b03ff07
--- /dev/null
+++ b/recipes-core/initrdscripts/initramfs-framework/qemuriscv64/ostree
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Copyright (C) 2018 Open Source Foundries Ltd.
+# Licensed on MIT
+
+ostree_enabled() {
+ return 0
+}
+
+ostree_run() {
+ if [ -n "$ROOTFS_DIR" ]; then
+ # HACK: try to boot out of the default ostree target on targets
+ # without bootloader support (no ostree= cmdline argument)
+ if ! grep -q "ostree=" /proc/cmdline; then
+ info "Fetching OSTree target from $ROOTFS_DIR/boot/loader/entries"
+ ostree_entry="$ROOTFS_DIR/boot/loader/entries/ostree-lmp-0.conf"
+ if [ ! -f $ostree_entry ]; then
+ fatal "ERROR: Unable to find default OSTree LMP boot entry $ostree_entry"
+ fi
+ ostree_target=`grep "^options " $ostree_entry | sed -e "s/.*ostree=//g"`
+ cmdline=`cat /proc/cmdline`
+ echo "$cmdline ostree=$ostree_target" > /run/cmdline
+ mount --bind -o ro /run/cmdline /proc/cmdline
+ fi
+ info "Preparing OSTree root at '$ROOTFS_DIR'..."
+ /usr/lib/ostree/ostree-prepare-root $ROOTFS_DIR
+ else
+ debug "No rootfs has been set"
+ fi
+}