deploy: support devicetree directory
Add support for a devicetree directory at /usr/lib/modules/$kver/dtb/. In ARM world a general purpose distribution often suppports multiple boards with a single operating system. However, OSTree currently only supports a single device tree, which does not allow to use the same OSTree on different ARM machines. In this scenario typically the boot loader selects the effective device tree. This adds device tree directory support for the new boot artefact location under /usr/lib/modules. If the file `devicetree` does not exist, then the folder dtb will be checked. All devicetrees are hashed into the deployment hash. This makes sure that even a single devicetree change leads to a new deployment and hence can be rolled back. The loader configuration has a new key "devicetreepath" which contains the path where devicetrees are stored. This is also written to the U-Boot variable "fdtdir". The boot loader is expected to use this path to load a particular machines device tree from. Closes: #1900 Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
This commit is contained in:
1 parent
c6eade5ce5
commit
5f08649f51
3 files changed
+151
-10
No files matched your search
@@ -25,9 +25,11 @@ set -euo pipefail
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive" "uboot"
|
||||
kver="3.6.0"
|
||||
modulesdir="usr/lib/modules/${kver}"
|
||||
setup_os_repository "archive" "uboot" ${modulesdir}
|
||||
|
||||
extra_admin_tests=1
|
||||
extra_admin_tests=2
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
@@ -52,3 +54,27 @@ assert_file_has_content sysroot/boot/uEnv.txt "kernel_image2="
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image3="
|
||||
|
||||
echo "ok merging uEnv.txt files"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
os_repository_new_commit "uboot test" "test with device tree directory"
|
||||
|
||||
devicetree_path=osdata/${modulesdir}/dtb/asoc-board.dtb
|
||||
devicetree_overlay_path=osdata/${modulesdir}/dtb/overlays/overlay.dtbo
|
||||
|
||||
mkdir -p osdata/${modulesdir}/dtb
|
||||
echo "a device tree" > ${devicetree_path}
|
||||
mkdir -p osdata/${modulesdir}/dtb/overlays
|
||||
echo "a device tree overlay" > ${devicetree_overlay_path}
|
||||
|
||||
bootcsum=$(
|
||||
(echo "new: a kernel uboot test" && echo "new: an initramfs uboot test" &&
|
||||
cat ${devicetree_path} ${devicetree_overlay_path} ) |
|
||||
sha256sum | cut -f 1 -d ' ')
|
||||
|
||||
${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||
assert_file_has_content sysroot/boot/uEnv.txt "fdtdir="
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/dtb/asoc-board.dtb 'a device tree'
|
||||
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/dtb/overlays/overlay.dtbo 'a device tree overlay'
|
||||
|
||||
echo "ok deploying fdtdir"
|
||||
Reference in new issue
Block a user