From b961be29edef521a418c7780007b845d20ad1c0b Mon Sep 17 00:00:00 2001 From: Maccraft123 Date: Fri, 1 Jan 2021 21:30:09 +0100 Subject: [PATCH] add script to boot new kernel once when developing on target device --- kernel/test-kernel | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 kernel/test-kernel diff --git a/kernel/test-kernel b/kernel/test-kernel new file mode 100755 index 00000000..8b52a78a --- /dev/null +++ b/kernel/test-kernel @@ -0,0 +1,38 @@ +#!/bin/bash +# partlabels boiiiiiiiiii +export KERNA=/dev/disk/by-partlabel/MMCKernelA +export KERNB=/dev/disk/by-partlabel/MMCKernelB + +export CADMIUMROOT=$1 + +source $CADMIUMROOT/config + +cd $CADMIUMROOT/tmp/linux-$TARGET/ + +# if anything fails, bail out +set -e + +# repack kernel +[ -f 'vmlinux.uimg' ] && rm vmlinux.uimg +mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg || true +dd if=/dev/zero of=bootloader.bin bs=512 count=1 +vbutil_kernel --pack vmlinux.kpart \ + --version 1 \ + --vmlinuz vmlinux.uimg \ + --arch aarch64 \ + --keyblock /usr/share/vboot/devkeys/kernel.keyblock \ + --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ + --config cmdline \ + --bootloader bootloader.bin +rm vmlinux.uimg + +# set tries to one +cgpt add -i 2 -t kernel -b 73728 -s 65536 -l MMCKernelB -S 0 -T 1 -P 15 /dev/mmcblk? + +make modules_install + +# write new kernel + +dd if=./vmlinux.kpart of=$KERNB + +echo "Save all data and reboot"