mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
emmctool: add initial package for Amlogic use
This commit is contained in:
parent
7f9696bd8d
commit
bf12b470e1
13
packages/tools/emmctool/package.mk
Normal file
13
packages/tools/emmctool/package.mk
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||||
|
|
||||||
|
PKG_NAME="emmctool"
|
||||||
|
PKG_VERSION="1.0"
|
||||||
|
PKG_LICENSE="GPLv2"
|
||||||
|
PKG_LONGDESC="emmctool: simple tool for writing LibreELEC images to emmc on supported box/board devices"
|
||||||
|
PKG_TOOLCHAIN="manual"
|
||||||
|
|
||||||
|
makeinstall_target() {
|
||||||
|
mkdir -p ${INSTALL}/usr/bin
|
||||||
|
cp ${PKG_DIR}/scripts/emmctool ${INSTALL}/usr/bin
|
||||||
|
}
|
@ -18,7 +18,7 @@ do_backup(){
|
|||||||
do_detect(){
|
do_detect(){
|
||||||
# used on LibreComputer LePotato/LaFrite where pre-formatted modules
|
# used on LibreComputer LePotato/LaFrite where pre-formatted modules
|
||||||
# must be attached after boot (LibreComputer supports this) else the
|
# must be attached after boot (LibreComputer supports this) else the
|
||||||
# device always boots to the pre-formatted OS on the module.
|
# device always boots to the pre-installed OS on the module.
|
||||||
echo "info: rebinding d0074000.mmc"
|
echo "info: rebinding d0074000.mmc"
|
||||||
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/unbind
|
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/unbind
|
||||||
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/bind
|
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/bind
|
||||||
@ -50,8 +50,8 @@ do_labels(){
|
|||||||
BOOTLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
BOOTLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||||
DISKLABEL=$(echo "${3}" | awk 'BEGIN { getline; print toupper($0) }')
|
DISKLABEL=$(echo "${3}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||||
else
|
else
|
||||||
BOOTLABEL="EMMC_BOOT"
|
BOOTLABEL="BOOT"
|
||||||
DISKLABEL="EMMC_DISK"
|
DISKLABEL="DISK"
|
||||||
fi
|
fi
|
||||||
echo "info: using boot=LABEL=${BOOTLABEL} and disk=LABEL=${DISKLABEL}"
|
echo "info: using boot=LABEL=${BOOTLABEL} and disk=LABEL=${DISKLABEL}"
|
||||||
do_umount
|
do_umount
|
||||||
@ -107,7 +107,7 @@ do_storage(){
|
|||||||
if [ -n "${2}" ]; then
|
if [ -n "${2}" ]; then
|
||||||
DISKLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
DISKLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||||
else
|
else
|
||||||
DISKLABEL="EMMC_DISK"
|
DISKLABEL="DISK"
|
||||||
fi
|
fi
|
||||||
do_umount
|
do_umount
|
||||||
echo "info: converting emmc for /storage use"
|
echo "info: converting emmc for /storage use"
|
||||||
@ -134,12 +134,25 @@ do_umount(){
|
|||||||
for mount in $(grep "${EMMC}" /proc/mounts | awk '{print $1}'); do
|
for mount in $(grep "${EMMC}" /proc/mounts | awk '{print $1}'); do
|
||||||
echo "info: unmounting $mount"
|
echo "info: unmounting $mount"
|
||||||
umount -f "$mount"
|
umount -f "$mount"
|
||||||
sleep 1
|
sleep 2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_writeprotect(){
|
||||||
|
echo "info: disabling emmc write protection"
|
||||||
|
echo 0 > "/sys/block/${EMMC}boot0/force_ro"
|
||||||
|
echo 0 > "/sys/block/${EMMC}boot1/force_ro"
|
||||||
|
}
|
||||||
|
|
||||||
do_write(){
|
do_write(){
|
||||||
do_umount
|
do_umount
|
||||||
|
|
||||||
|
case $(dtname) in
|
||||||
|
radxa,zero)
|
||||||
|
do_writeprotect
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "${2: -7}" == ".img.gz" ]; then
|
if [ "${2: -7}" == ".img.gz" ]; then
|
||||||
echo "info: writing ${2} to ${EMMC}"
|
echo "info: writing ${2} to ${EMMC}"
|
||||||
gunzip -c "${2}" | dd of="${EMMC}" bs=1M
|
gunzip -c "${2}" | dd of="${EMMC}" bs=1M
|
||||||
@ -161,15 +174,15 @@ do_zero(){
|
|||||||
|
|
||||||
do_help(){
|
do_help(){
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: emmctool (w)rite <filename> : write <filename>.img/.img.gz to the eMMC module"
|
echo "usage: emmctool (w)rite <filename> : write <filename>.img/.img.gz to the eMMC module"
|
||||||
echo " (b)backup <filename> : dump the emmc partition to an .img.gz file"
|
echo " (b)backup <filename> : dump the emmc partition to <filename>.img.gz file"
|
||||||
echo " (d)etect : detect an eMMC module attached after boot"
|
echo " (d)etect : detect an eMMC module attached after boot"
|
||||||
echo " (i)nfo : show info about the eMMC module"
|
echo " (i)nfo : show info about the eMMC module"
|
||||||
echo " (l)abels : change eMMC disk labels to ${BOOTLABEL}/${DISKLABEL}"
|
echo " (l)abel <boot> <disk> : change eMMC disk labels to <bootlabel> <disklabel>"
|
||||||
echo " (r)esize : resize the storage partition to 100%"
|
echo " (r)esize : resize the storage partition to 100%"
|
||||||
echo " (s)storage : convert emmc for use as /storage (boot from sdcard)"
|
echo " (s)storage : convert emmc for use as /storage (boot from sdcard)"
|
||||||
echo " (z)ero : zero (erase/wipe) the eMMC module"
|
echo " (z)ero : zero (erase/wipe) the eMMC module"
|
||||||
echo " (h)elp : displays this help message"
|
echo " (h)elp : displays this help message"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +195,7 @@ if [ -z "${EMMC}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $(dtname) in
|
case $(dtname) in
|
||||||
friendlyarm*|hardkernel*|khadas*|libretech*|wetek*)
|
azw*|bananapi*|friendlyarm*|hardkernel*|khadas*|libretech*|radxa*|wetek*)
|
||||||
if [ "${BOOT}" = "${EMMC}" ]; then
|
if [ "${BOOT}" = "${EMMC}" ]; then
|
||||||
do_info
|
do_info
|
||||||
echo "Your device is booted from the eMMC module!"
|
echo "Your device is booted from the eMMC module!"
|
@ -75,7 +75,7 @@
|
|||||||
DRIVER_ADDONS="crazycat dvb-latest"
|
DRIVER_ADDONS="crazycat dvb-latest"
|
||||||
|
|
||||||
# additional packages to install:
|
# additional packages to install:
|
||||||
ADDITIONAL_PACKAGES="dtc ethmactool flashrom"
|
ADDITIONAL_PACKAGES="dtc ethmactool emmctool flashrom"
|
||||||
|
|
||||||
# use the kernel CEC framework for libcec (yes / no)
|
# use the kernel CEC framework for libcec (yes / no)
|
||||||
CEC_FRAMEWORK_SUPPORT="yes"
|
CEC_FRAMEWORK_SUPPORT="yes"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user