BTRFS file system for MAIN and rootfs partition (#65)

* BTRFS file system for MAIN and rootfs partition
This commit is contained in:
tiopex
2023-12-13 07:14:00 +01:00
committed by GitHub
parent 2f89873479
commit 130d2be1f3
33 changed files with 165 additions and 162 deletions

View File

@@ -20,7 +20,7 @@
::sysinit:/bin/mkdir -p /dev/shm
::sysinit:/bin/mount -a
::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/bin/mount /dev/mmcblk0p4 /mnt -t vfat -o rw,sync,utf8
::sysinit:/bin/mount /dev/mmcblk0p4 /mnt -o discard=async,noatime,nodiratime,exec
::sysinit:/bin/mount /dev/mmcblk0p1 /boot -t vfat -o ro,exec,sync,utf8
::sysinit:/sbin/mkswap /dev/mmcblk0p3
::sysinit:/sbin/swapon /dev/mmcblk0p3

View File

@@ -26,9 +26,9 @@ fi
# load kernel modules
# load usb gadget
mount -t configfs none /sys/kernel/config >> "${LOGS}" 2>&1
gadget-ms /dev/mmcblk0p1 /dev/mmcblk0p4 >> "${LOGS}" 2>&1
modprobe g_ffs idVendor=0x1fc9 idProduct=0x0146 iSerialNumber="01234567" iProduct="Miyoo CFW 2.0" iManufacturer="Miyoo Handheld" functions=mtp >> "${LOGS}" 2>&1
mkdir /dev/ffs-mtp && mount -t functionfs mtp /dev/ffs-mtp >> "${LOGS}" 2>&1
umtprd >> "${LOGS}" 2>&1 &
# Load the expected one screen driver from here with modprobe
## automatically from rootfs/lib/modules/VERSION
@@ -77,19 +77,18 @@ elif test -r "${HOME}/firstboot.completed"; then
fi
if !(grep -q FAT_CHECK\=\0 "${HOME}/options.cfg"); then
##Check if fat32 is flagged as "dirty", and if so unmount, repair, remount
if dmesg | grep "mmcblk0p4" > /dev/null; then
echo -e "\e[31mUnclean shutdown detected.\e[0m"
echo -e "\e[32mChecking FAT32 partition...\e[0m"
umount /dev/mmcblk0p4
fsck.vfat -y /dev/mmcblk0p4 > /dev/null;
mount /dev/mmcblk0p4 "${HOME}" -t vfat -o rw,sync,utf8
##Check if FAT16 is flagged as "dirty", and if so unmount, repair, remount
if dmesg | grep "mmcblk0p1" > /dev/null; then
echo -e "\e[31mDirty sectors detected.\e[0m"
echo -e "\e[32mChecking&Repairing FAT16 BOOT partition...\e[0m"
umount /dev/mmcblk0p1
fsck.vfat -y /dev/mmcblk0p1 > /dev/null;
mount /dev/mmcblk0p1 "${BOOTDIR}" -t vfat -o ro,exec,sync,utf8
echo -e "\e[32mCheck complete.\e[0m"
fi
fi
clear
# try to read what handheld we're on
if test -r "${BOOTDIR}/console.cfg"; then
source "${BOOTDIR}/console.cfg"

View File

@@ -0,0 +1,88 @@
#
# uMTP Responder config file
# Must be copied to /etc/umtprd/umtprd.conf
#
# Loop / daemon mode
# Set to 1 to don't shutdown uMTPrd when the link is disconnected.
loop_on_disconnect 1
#storage command : Create add a storage entry point. Up to 16 entry points supported
#Syntax : storage "PATH" "NAME"
storage "/" "rootfs" "ro"
storage "/mnt" "MAIN" "rw"
storage "/boot" "BOOT" "ro"
#
# Uncomment the following line if you want to
# override the system default umask value for
# the uploaded files.
#
umask 000
# Set the USB manufacturer string
manufacturer "Miyoo CFW 2.0"
# Set the USB Product string
product "Miyoo Handheld"
# Set the USB Serial number string
serial "01234567"
# Set the USB interface string. Should be always "MTP"
interface "MTP"
# Set the USB Vendor ID, Product ID and class
usb_vendor_id 0x1D6B # Linux Foundation
usb_product_id 0x0100 # PTP Gadget
usb_class 0x6 # Image
usb_subclass 0x1 # Still Imaging device
usb_protocol 0x1 #
# Device version
usb_dev_version 0x3008
# inotify support
# If you want disable the events support (beta), uncomment the following line :
# no_inotify 0x1
#
# Internal buffers size
#
# Internal default usb_max_rd_buffer_size and usb_max_wr_buffer_size value set to 0x10000.
# Internal default read_buffer_cache_size value set to 0x100000.
# Uncomment the following lines to reduce the buffers sizes to fix USB issues on iMX6 based systems.
usb_max_rd_buffer_size 0x8000 # MAX usb read size. Must be a multiple of 512 and be less than read_buffer_cache_size
usb_max_wr_buffer_size 0x8000 # MAX usb write size. Must be a multiple of 512.
# read_buffer_cache_size 0x8000 # Read file cache buffer. Must be a 2^x value.
#
# USB gadget device driver path
#
########################################################################
#
# -- Generic FunctionFS Mode --
#
########################################################################
usb_functionfs_mode 0x1
usb_dev_path "/dev/ffs-mtp/ep0"
usb_epin_path "/dev/ffs-mtp/ep1"
usb_epout_path "/dev/ffs-mtp/ep2"
usb_epint_path "/dev/ffs-mtp/ep3"
usb_max_packet_size 0x200