Created
December 29, 2022 02:20
-
-
Save victor-oliveira1/ca3a0f968f295e047f0b7fb4d0dfe025 to your computer and use it in GitHub Desktop.
Install Lakka on 2GB SDCard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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