Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

software:oowow:how-to:oowow-autoinstall-disk

This is an old revision of the document!


OOWOW auto-install disk

Sometimes, your device has limited access (no keyboard, network, etc … ), and we need to update eMMC storage content automatically. What did we need? Just prepare a special removable disk

These features can work from SD / USB removable disk

Preparation

Autoinstall

  • Plug prepared removable disk into your device
  • Reboot into OOWOW mode by any way - just reset your device if it can boot up from this removable disk or by a special shortcut or i2c command if device has embedded oowow
  • Wait for autoinstallation, all processes must go automatically
  • Reboot to upgraded system

Image filename rules

BOARD.*.emmc.img.zst put into root on 2n SD partition with label dump

Auto-install config

Stored into rescue/config/autoinstall on 1st SD partition with label rescue

Auto-install config format

/config/autoinstall
BOARD.image_name[.BYTES-bytes].img.[zst|gz] [-sBYTES] [-r]
 
# BOARD         board name [ VIM1 | VIM2 | VIM3 | VIM3L |  Edge | Edge2 | VIM1S | VIM4 ]
# .BYTES-bytes   write size limitation tag
# -sBYTES       write size limitation parameter
# -r            resize fs parameter

Example configs

/config/autoinstall
VIM3.hg_1.0.emmc.img.zst
/config/autoinstall
VIM3.hg_1.0.emmc.img.zst -s15634268160
/config/autoinstall
VIM3.hg_1.0.emmc.img.zst -s15634268160 -r 
/config/autoinstall
VIM3.hg_1.0.15634268160-bytes.emmc.img.zst -r 

Config setup by command-line

edit-and-save-auto-install-config
~$ echo VIM3.hg_1.0.emmc.img.zst -s15634268160 > /config/autoinstall
~$ krescue.configs -s
print-auto-intall-config
~$ krescue.configs -p | grep autoinstall
config_autoinstall="VIM3.hg_1.0.emmc.img.zst -s15634268160"
display-auto-intall-config
~$ cat /config/autoinstall
VIM3.hg_1.0.emmc.img.zst -s15634268160
disable-autoinstall
~$ rm /config/autoinstall && krescue.config -s 

Also can setup write size by image filename *.SIZE-bytes.*

  • VIM3.hg_1.0.17179869184-bytes.emmc.img.zst
  • VIM3.hg_1.0.16G-bytes.emmc.img.zst
  • VIM3.hg_1.0.16384M-bytes.emmc.img.zst

Dump images created automatically with bytes tag, and better continue use this tag as is

Check blank trail image

can write only 11100000000 bytes for example

check.sh
tail -c+11100000000 VIM3.hg_1.0.emmc.img | hexdump -C

Resize FS

resiez_root_fs.sh
root@localhost:~# df /
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/rootfs     14779408 5847484   8741216  41% /
 
root@localhost:~# resize2fs /dev/rootfs 
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/rootfs is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/rootfs is now 7587840 (4k) blocks long.
 
root@localhost:~# df /
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/rootfs     29808700 5848092  23618452  20% /

Custom disk create

Another way create installation disk by script

This way can used only with embeded oowow, and need boot device into oowow mode from SPI flash

example
DISK=/dev/sda ./autoinstall edge2-armbian-bookworm-legacy-minimal.img.xz
autoinstall-disk-create
#!/bin/sh
 
#= USAGE: DISK=/dev/sdX ./autoinstall-disk-create [IMAGE]
 
DISK=${DISK:-/dev/sda}
IMAGE=${IMAGE:-$1}
 
FAIL(){
    echo "[fail] $@">&2
    exit 1
}
CMD(){
    echo "# $@">&2
    sudo "$@" || FAIL
}
 
[ -s "$IMAGE" ] || FAIL "image undefined"
 
# create parts
cat <<EOF | CMD sfdisk $DISK
label: dos
1 : start=       24576, size=      106496, type=e
2 : start=      131072, type=7
EOF
 
P1=${DISK}1
P2=${DISK}2
# format partiotions
CMD mkfs.vfat -n rescue -i DEADBEEF $P1
CMD mkfs.exfat -n dumps $P2
 
CMD mkdir -p /tmp/dump /tmp/rescue
# copy image
 
CMD mount $P2 /tmp/dump
CMD cp $IMAGE /tmp/dump
 
ls -l1 /tmp/dump
 
# create config
CMD mount $P1 /tmp/rescue
C=/tmp/rescue/rescue/config
CMD mkdir -p $C
echo $IMAGE | CMD tee $C/autoinstall
 
CMD umount $P1 $P2
 
echo DONE
Last modified: 2023/08/24 06:39 by hyphop