Yes, it not matter where it is . 2 conditions: there must be enough free space (5GB or more) and it must not be a device to which the image will subsequently be writed. For example, you can save the file to a second USB flash drive, unpack it there and then write the image to the first USB flash drive. Also, the device to which the image will be written must be unmounted, otherwise there may be unexpected errors.
Option I proposed has some limitation on the size of the system disk. In order to use the full size of your flash drive, you need to partition the disk as descibed in the installation guide. At step 7, where you need to substitute the number obtained from the previous command, apostrophes are used (the key under the escape) and not quotes. Or you can use some calculator and place result instead of
`expr xxxxx - 40960`. If everything worked out except for booting, you can try the kernel from the last link. It is the same standard kernel, but without blobs for the rockchip etc. (less than 8Mb)
edit 10.12.21
Since links dead, I think I post instruction how I did re-sign kernel, maybe it helps someone. This produces 7,5M kernel image from installed default kernel package and result is successfully boots in my case. Probably it can be done from chroot.
- mkdir /boot/reflash and place there
kernel_data_key.vbprivk,
kernel.keyblock from
https://github.com/archlinuxarm/PKGBUILDs/tree/master/core/linux-armv7 and
kernel.its,
kerninst; chmod +x kerninst
-
sudo pacman -S uboot-tools vboot-utils dtc- execute /boot/kerninst with root privileges, press y to re-sign, press enter, press enter for use default bootstring, specify partition number from list for flashing, press enter and reboot
By the way, with wrong partition you may destroy your chrome-os, be aware
Since kernel.its refers to /boot/dtbs/*.dtb and /boot/zImage they should exist, or you may wtite another path
Scripts not mine.
kernel.its
$this->bbcode_second_pass_code('', '/dts-v1/;
/ {
description = "Chrome OS kernel image with one or more FDT blobs";
#address-cells = <1>;
images {
kernel@1 {
description = "kernel";
data = /incbin/("/boot/zImage");
type = "kernel_noload";
arch = "arm";
os = "linux";
compression = "none";
load = <0>;
entry = <0>;
};
fdt@1 {
description = "exynos5250-snow.dtb";
data = /incbin/("/boot/dtbs/exynos5250-snow.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1 {
algo = "sha1";
};
};
fdt@2 {
description = "exynos5250-snow-rev5.dtb";
data = /incbin/("/boot/dtbs/exynos5250-snow-rev5.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1 {
algo = "sha1";
};
};
fdt@3 {
description = "exynos5250-spring.dtb";
data = /incbin/("/boot/dtbs/exynos5250-spring.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1 {
algo = "sha1";
};
};
fdt@4 {
description = "exynos5800-peach-pi.dtb";
data = /incbin/("/boot/dtbs/exynos5800-peach-pi.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1{
algo = "sha1";
};
};
fdt@5 {
description = "exynos5420-peach-pit.dtb";
data = /incbin/("/boot/dtbs/exynos5420-peach-pit.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash@1 {
algo = "sha1";
};
};
};
configurations {
default = "conf@1";
conf@1 {
kernel = "kernel@1";
fdt = "fdt@1";
};
conf@2 {
kernel = "kernel@1";
fdt = "fdt@2";
};
conf@3 {
kernel = "kernel@1";
fdt = "fdt@3";
};
conf@4 {
kernel = "kernel@1";
fdt = "fdt@4";
};
conf@5 {
kernel = "kernel@1";
fdt = "fdt@5";
};
};
};
')
kerninst
$this->bbcode_second_pass_code('', '#!/bin/bash
if [ "$(whoami)" == "root" ]; then
# resign kernel
echo "
You may re-sign kernel and customize kernel boot string.
Regular user do not need it, so it is safe to press n.
Do you want to do this? (y/n)
"
read -r tmpvar1
if $(echo $tmpvar1 | grep -q [Yy]); then
bootcmd='console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw zswap.compressor=zstd zswap.max_pool_percent=40 audit=0'
echo "default bootcmd is
$bootcmd
Be very careful, without init=/sbin/init root=PARTUUID=%U/PARTNROFF=1
or something like that your could get a bootfail.
Now you may specify a new one or just press Enter"
tmpvar2=""
read -r tmpvar2
if [ ! -z "$tmpvar2" ]; then
bootcmd="$tmpvar2"
else
echo "Will be used default boot string
"
fi
#
mkimage -D "-I dts -O dtb -p 2048" -f /boot/reflash/kernel.its /tmp/vmlinux.uimg
# make empty bootloader
dd if=/dev/zero of=/tmp/bootloader.bin bs=512 count=1
echo $bootcmd > /tmp/cmdline
# backup default kernel.img
mv -f /boot/kernel.img /boot/backup_kernel.img
# final step
vbutil_kernel \
--pack /boot/kernel.img \
--version 1 \
--vmlinuz /tmp/vmlinux.uimg \
--arch arm \
--keyblock /boot/reflash/kernel.keyblock \
--signprivate /boot/reflash/kernel_data_key.vbprivk \
--config /tmp/cmdline \
--bootloader /tmp/bootloader.bin
# clear used files
rm -f /tmp/vmlinux.uimg /tmp/cmdline /tmp/bootloader.bin
fi
# flash kernel
krnprts=""
krnprtc=0
for i in $(ls /dev | grep -x --regexp="mmcblk[0-9]" --regexp="sd[a-z]" --regexp="vd[a-z]"); do
if $(cgpt show /dev/$i | grep Label | grep -q [Kk]ernel); then
if $(echo $i | grep -q mmcblk); then
krnprts+="$i""p$(cgpt show /dev/$i | grep Label | grep [Kk]ernel -m 1 | sed 's/ / /g' | sed 's/ / /g' | sed 's/ La.*//g' | sed 's/.* //g') "
else
krnprts+="$i$(cgpt show /dev/$i | grep Label | grep [Kk]ernel -m 1 | sed 's/ / /g' | sed 's/ / /g' | sed 's/ La.*//g' | sed 's/.* //g') "
fi
krnprtc=$(($krnprtc+1))
fi
done
echo ""
if [ "$krnprtc" -eq 0 ]; then
echo "Chrome OS kernel partition did not detected."
echo "You must reflash kernel manually."
elif [ "$krnprtc" -eq 1 ]; then
echo "Finded ChromeOs kernel partition - $krnprts"
echo "Do you want to flash a new kernel to it? (y/n)"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
dd if=/boot/kernel.img of=/dev/$krnprts
sync
else
echo "You may flash kernel manually like:"
echo "dd if=/boot/kernel.img of=/dev/$krnprts"
fi
else
echo "Finded more than one Chrome OS kernel partition."
echo "You need to select next action
"
echo "0 for do not flash"
numpart=0
for i in $krnprts; do
numpart=$(($numpart+1))
echo "$numpart for flash $i partition"
done
echo ""
echo "Wrong partition may lead to bootfail. Be aware!"
read -r shouldwe
if [ $shouldwe -gt 0 ]&&[ $shouldwe -le $numpart ]; then
numpart=0
for i in $krnprts; do
numpart=$(($numpart+1))
if [ $numpart -eq $shouldwe ]; then
dd if=/boot/kernel.img of=/dev/$i
sync
fi
done
fi
fi
else
echo superuser rights required
fi
')