Skip to content

Instantly share code, notes, and snippets.

@victor-oliveira1
Created December 29, 2022 02:20
Show Gist options
  • Select an option

  • Save victor-oliveira1/ca3a0f968f295e047f0b7fb4d0dfe025 to your computer and use it in GitHub Desktop.

Select an option

Save victor-oliveira1/ca3a0f968f295e047f0b7fb4d0dfe025 to your computer and use it in GitHub Desktop.
Install Lakka on 2GB SDCard
#!/usr/bin/env bash
IMAGE="$1"
DISK="$2"
TEMPDIR=$(mktemp -d)
parted --script "$DISK" \
mklabel msdos \
mkpart primary fat32 0% 1G \
mkpart primary ext4 1G 100%
sync
mkfs.fat -n LAKKA "$DISK"1
mkfs.ext4 -F -L LAKKA_DISK "$DISK"2
mkdir "$TEMPDIR"/{IMAGE,LAKKA}
mount -o offset=4194304 "$IMAGE" "$TEMPDIR"/IMAGE
mount "$DISK"1 "$TEMPDIR"/LAKKA
rsync -avP "$TEMPDIR"/IMAGE/ "$TEMPDIR"/LAKKA/
sync
test -a "$TEMPDIR"/LAKKA/uEnv.ini && {
CMDFILE=uEnv.ini
sed -i "$TEMPDIR"/LAKKA/"$CMDFILE" \
-e 's/@@DTB_NAME@@/meson-sm1-x96-air-100.dtb/'
} || {
CMDFILE=cmdline.txt
echo "temp_soft_limit=70" >> "$TEMPDIR"/LAKKA/config.txt
sed -i 's/gpu_mem=.*/gpu_mem=32/' "$TEMPDIR"/LAKKA/config.txt
}
sed -i "$TEMPDIR"/LAKKA/"$CMDFILE" \
-e 's/boot=UUID=[^ ]*/boot=LABEL=LAKKA/' \
-e 's/disk=UUID=[^ ]*/disk=LABEL=LAKKA_DISK/' \
-e '${s/$/ video=1280x720-32@60/}'
sync
umount "$TEMPDIR"/IMAGE "$TEMPDIR"/LAKKA/ && rm -rfv "$TEMPDIR"
eject "$DISK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment