diff options
author | Eric Woudstra | 2023-03-14 22:04:57 +0100 |
---|---|---|
committer | Eric Woudstra | 2023-03-14 22:04:57 +0100 |
commit | 674cb0825d05c5edd9ac522d853e73d5d9efb228 (patch) | |
tree | 6cd1b538af4a81329a7c9d3de854f88cf3c90afd /bpir3-flash2emmc | |
parent | df28bde2cf7eeba2c15902eccc6f3b176ac549dd (diff) | |
download | aur-674cb0825d05c5edd9ac522d853e73d5d9efb228.tar.gz |
setup initrd
Diffstat (limited to 'bpir3-flash2emmc')
-rwxr-xr-x | bpir3-flash2emmc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bpir3-flash2emmc b/bpir3-flash2emmc new file mode 100755 index 000000000000..9e32c01a7d47 --- /dev/null +++ b/bpir3-flash2emmc @@ -0,0 +1,32 @@ +#!/usr/bin/ash + +# Tool for %PKGBASE% package, needs to run from initrd! +# Connect UART and when kernel starts, keep 'x' key pressed. + +mkdir -p /tmp/mnt +mount --source /dev/disk/by-partlabel/*-sdmmc-root --target /tmp/mnt +[ $? -ne 0 ] && exit +[ ! -e "/tmp/mnt$1" ] && exit +echo "Reading file $1 now..." +cp -f "/tmp/mnt$1" "/tmp/tempfile" +umount /tmp/mnt +[ $? -ne 0 ] && exit + +while [ ! -e /sys/block/mmcblk0boot0 ]; do + echo 11230000.mmc >/sys/bus/platform/drivers/mtk-msdc/unbind + sleep 0.1 + echo 11230000.mmc >/sys/bus/platform/drivers/mtk-msdc/bind + echo "Flip SD/EMMC switch now!" + sleep 1.9 +done + +echo "Setting up EMMC so that mmcblk0boot0 is the bootdevice." +mmc bootpart enable 1 1 /dev/mmcblk0 +echo "Writing $1 to EMMC now..." +xz -dcv "/tmp/tempfile" | dd of=/dev/mmcblk0 conv=fsync,notrunc + +echo "Copying atf partition to mmcblk0boot0" +echo 0 >/sys/block/mmcblk0boot0/force_ro +dd if=/dev/mmcblk0 of=/dev/mmcblk0boot0 bs=512 skip=34 count=1024 conv=fsync,notrunc +echo 1 >/sys/block/mmcblk0boot0/force_ro + |