diff --git a/board/miyoo/boot/configs/manifest b/board/miyoo/boot/configs/manifest index 19f7997b3..bc5cb5cf5 100644 --- a/board/miyoo/boot/configs/manifest +++ b/board/miyoo/boot/configs/manifest @@ -2,10 +2,6 @@ ! format: each line corresponds to one file to be copied over ! from_file(as_appears_in_this_directory) to_file(relative_to_root_of_main_partition) ! to_file is optional; if missing will use from_file -.backlight.conf -.volume.conf -.buttons.conf -.batterylow.conf gmenu2x.conf gmenu2x/gmenu2x.conf input.conf gmenu2x/input.conf ! leave this last line here diff --git a/board/miyoo/boot/firstboot b/board/miyoo/boot/firstboot index 82d6a34e7..5273a2bec 100755 --- a/board/miyoo/boot/firstboot +++ b/board/miyoo/boot/firstboot @@ -503,7 +503,7 @@ P4_SIZE=$(cat "/sys/block/mmcblk0/mmcblk0p4/size") SD_SIZE_IN_MiB=$((SD_SIZE * 512 / 1024 / 1024)) SD_SIZE_IN_GiB=$((SD_SIZE * 512 / 1024 / 1024 / 1024)) BOOT_SIZE=$(((1016+1) * 1024 / 512)) #bootloader partition=1016K (see `genimage` script in buildroot) -## boot_size calculated to 512 byte sector size blocks, adding +1K as a safety measure for roundups (at fatresize we use KibiBits) +## boot_size calculated to 512 byte sector size blocks, adding +1K as a safety measure for roundups (at ntfsresize we use KibiBits) #Calculate unallocated left space to expand MAIN: SD_MAX_UNALL_SIZE="$((${SD_SIZE} - (${P1_SIZE} + ${P2_SIZE} + ${P3_SIZE} + ${P4_SIZE}) - $BOOT_SIZE))" @@ -514,25 +514,14 @@ SD_MAX_UNALL_SIZE_IN_GiB=$(echo "scale=1; ${SD_MAX_UNALL_SIZE} * 512 / 1024 / 10 SD_MAX_AVAIL_SIZE="$((${SD_SIZE} - (${P1_SIZE} + ${P2_SIZE} + ${P3_SIZE}) - $BOOT_SIZE))" SD_MAX_AVAIL_SIZE_IN_KiB=$((SD_MAX_AVAIL_SIZE * 512 / 1024)) -# Expand_MAIN_Partition-prompt for fatresize the p4 partition if requested +# Expand_MAIN_Partition-prompt for ntfsresize the p4 partition if requested RESIZE_COMMENCED=false if (dialog --clear --stdout --ok-label YES --cancel-label NO --title " AUTO-RESIZE" \ --colors --pause "\n\n \ZuExpand MAIN partition?\Zn\n\n Select an option & press START - \n\n \ZbWARNING:\Zn\n After 10s auto-resize\n of FAT32 partition will begin." 15 60 10); then + \n\n \ZbWARNING:\Zn\n After 10s auto-resize\n of NTFS partition will begin." 15 60 10); then clear RESIZE_ABORT=false - if test "$SD_SIZE_IN_GiB" -gt 128; then - if (dialog --clear --stdout --ok-label NO --cancel-label YES --title " \Zb\Z1WARNING!\Zn" \ - --colors --pause "\nYour SD card exceeds max. size for auto-resizing! - \n\nWe could however expand it to 118GB. \n\n \ZuDo you AGREE?\Zn - \n\n\ZbINFO: For microSD >128GB big we\n recommend to use your PC!\Zn" 0 0 30 || test $? -eq 255); then - dialog --clear --colors --timeout 2 --msgbox " FAT resizing \ZuABORTED!\Zn" 5 27 - clear - RESIZE_ABORT=true - else - SD_MAX_AVAIL_SIZE_IN_KiB=123731968 - fi - fi + SD_MAX_AVAIL_SIZE_IN_GiB=$(echo "scale=1; ${SD_MAX_AVAIL_SIZE_IN_KiB} / 1024 / 1024" | bc) #only to inform user about end point for resize SD_MAX_AVAIL_SIZE_IN_GB=$(echo "scale=1; ${SD_MAX_AVAIL_SIZE_IN_KiB} * 1024 / 1000 / 1000 / 1000" | bc) P4_SIZE_IN_GB=$(echo "scale=1; ${P4_SIZE} * 512 / 1000 / 1000 / 1000" | bc) @@ -550,17 +539,19 @@ if (dialog --clear --stdout --ok-label YES --cancel-label NO --title " AUTO-RE echo "and more precisely it's ${SD_MAX_UNALL_SIZE_IN_MiB}MB big" | tee -a ${LOG} if ! $RESIZE_ABORT; then echo "Resizing the MAIN partition to ${SD_MAX_AVAIL_SIZE_IN_GiB}GB." | tee -a ${LOG} - echo "This can take A LONG TIME, so be patient." | tee -a ${LOG} + echo "This can take few seconds." | tee -a ${LOG} umount /dev/mmcblk0p4 | tee -a ${LOG} - fsck.fat -y /dev/mmcblk0p4 | tee -a ${LOG} - #TODO: fix outputting logs from fatresize stdout - fatresize --size="${SD_MAX_AVAIL_SIZE_IN_KiB}"ki -v -p /dev/mmcblk0p4 -n4 | tee -a ${LOG} - fsck.fat -y /dev/mmcblk0p4 | tee -a ${LOG} + ntfsfix -d /dev/mmcblk0p4 | tee -a ${LOG} + parted -a optimal /dev/mmcblk0 --script rm 4 | tee -a ${LOG} + parted -a optimal /dev/mmcblk0 --script mkpart primary ntfs 546MB 100% | tee -a ${LOG} + partx -u /dev/mmcblk0 | tee -a ${LOG} + echo Y | ntfsresize --size="${SD_MAX_AVAIL_SIZE_IN_KiB}"k -v /dev/mmcblk0p4 | tee -a ${LOG} + ntfsfix -d /dev/mmcblk0p4 | tee -a ${LOG} echo -n -e \\xEB\\x58\\x90 > /dev/mmcblk0p4 sync - mount -t vfat -o rw,sync,utf8 /dev/mmcblk0p4 ${HOME} | tee -a ${LOG} + mount -t ntfs3 /dev/mmcblk0p4 ${HOME} | tee -a ${LOG} else - echo "MAIN fat partition resizing was aborted!" | tee -a ${LOG} + echo "MAIN ntfs partition resizing was aborted!" | tee -a ${LOG} sleep 2 fi RESIZE_COMMENCED=true @@ -599,8 +590,6 @@ if test -r "${BASEDIR}/configs/manifest"; then fi done fi -echo "Renaming ${HOME}/retroarch directory to ${HOME}/.retroarch" | tee -a ${LOG} -mv "${HOME}/retroarch" "${HOME}/.retroarch" | tee -a ${LOG} echo @@ -610,7 +599,7 @@ touch ${HOME}/firstboot.completed echo # Reboot device if CONSOLE_VARIANT was overwritten from $CHOICE so that it could be applied in u-boot by readID -## or resizing FAT partition has completed / found firstboot custom script +## or resizing NTFS partition has completed / found firstboot custom script if ($CONSOLE_OVERWRITE || $RESIZE_COMMENCED || test -r "${BASEDIR}/firstboot.custom.sh"); then safe_reboot_func else diff --git a/board/miyoo/genimage-sdcard.cfg b/board/miyoo/genimage-sdcard.cfg index 8d84c9704..bb78bcd75 100644 --- a/board/miyoo/genimage-sdcard.cfg +++ b/board/miyoo/genimage-sdcard.cfg @@ -33,13 +33,6 @@ image bootfs.vfat { size = 8M } -image mainfs.vfat { - vfat { - label = "MAIN" - } - mountpoint = "../../../images/main/" - size = 640M -} image ${IMAGE_NAME:-miyoo-cfw-2.0.0.img} { @@ -72,6 +65,6 @@ image ${IMAGE_NAME:-miyoo-cfw-2.0.0.img} { partition main { partition-type = 0xc bootable = "false" - image = "mainfs.vfat" + image = "main.img" } } diff --git a/board/miyoo/boot/configs/.backlight.conf b/board/miyoo/main/.backlight.conf similarity index 100% rename from board/miyoo/boot/configs/.backlight.conf rename to board/miyoo/main/.backlight.conf diff --git a/board/miyoo/boot/configs/.batterylow.conf b/board/miyoo/main/.batterylow.conf similarity index 100% rename from board/miyoo/boot/configs/.batterylow.conf rename to board/miyoo/main/.batterylow.conf diff --git a/board/miyoo/boot/configs/.buttons.conf b/board/miyoo/main/.buttons.conf similarity index 100% rename from board/miyoo/boot/configs/.buttons.conf rename to board/miyoo/main/.buttons.conf diff --git a/board/miyoo/boot/configs/.volume.conf b/board/miyoo/main/.volume.conf similarity index 100% rename from board/miyoo/boot/configs/.volume.conf rename to board/miyoo/main/.volume.conf diff --git a/board/miyoo/main/apps/fsck/fsck.sh b/board/miyoo/main/apps/fsck/fsck.sh index 60305afc3..664a40a03 100644 --- a/board/miyoo/main/apps/fsck/fsck.sh +++ b/board/miyoo/main/apps/fsck/fsck.sh @@ -13,18 +13,6 @@ echo -e "\e[32mChecking FAT32 (BOOT) partition...\e[0m" fsck.vfat -a /dev/mmcblk0p1 fi -if dmesg | grep "mmcblk0p4"; then -echo -e "\e[31mUnclean shutdown detected.\e[0m" -echo -e "\e[32mChecking FAT32 (MAIN) partition...\e[0m" -fsck.vfat -a /dev/mmcblk0p4 -echo " " -echo "Rebooting device, please wait..." -echo " " -sleep 2 -sync -reboot -fi - echo "Finished!" echo " " echo " " diff --git a/board/miyoo/main/options.cfg b/board/miyoo/main/options.cfg index 39fc0f291..2b4a4ddfa 100644 --- a/board/miyoo/main/options.cfg +++ b/board/miyoo/main/options.cfg @@ -1,5 +1,5 @@ MODULES_CUSTOM=0 -FAT_CHECK=1 +NTFS_CHECK=1 BOOT_LOGO=1 FLIP= (put 0 or 1 to overwrite) INVERT= (put 0 or 1 to overwrite) diff --git a/board/miyoo/rootfs/etc/inittab b/board/miyoo/rootfs/etc/inittab index b38c69838..426cda8f2 100644 --- a/board/miyoo/rootfs/etc/inittab +++ b/board/miyoo/rootfs/etc/inittab @@ -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 -t ntfs3 ::sysinit:/bin/mount /dev/mmcblk0p1 /boot -t vfat -o ro,exec,sync,utf8 ::sysinit:/sbin/mkswap /dev/mmcblk0p3 ::sysinit:/sbin/swapon /dev/mmcblk0p3 diff --git a/board/miyoo/rootfs/etc/main b/board/miyoo/rootfs/etc/main index e7eb6a8e8..d64ae9e18 100755 --- a/board/miyoo/rootfs/etc/main +++ b/board/miyoo/rootfs/etc/main @@ -76,14 +76,17 @@ elif test -r "${HOME}/firstboot.completed"; then rm "${HOME}/firstboot.completed" 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 !(grep -q NTFS_CHECK\=\0 "${HOME}/options.cfg"); then +##Check if ntfs 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 + echo -e "\e[32mChecking NTFS partition...\e[0m" + ntfsfix -d /dev/mmcblk0p4 > /dev/null; + mount /dev/mmcblk0p4 "${HOME}" -t ntfs3 + if [ $? -ne 0 ]; then + sync + reboot + fi echo -e "\e[32mCheck complete.\e[0m" fi fi diff --git a/board/miyoo/scripts/genimage.sh b/board/miyoo/scripts/genimage.sh index e9222cb0d..7406eccbd 100755 --- a/board/miyoo/scripts/genimage.sh +++ b/board/miyoo/scripts/genimage.sh @@ -17,7 +17,7 @@ cp -r board/miyoo/main "${BINARIES_DIR}" test -d "${BINARIES_DIR}/gmenu2x" && cp -r "${BINARIES_DIR}/gmenu2x/" "${BINARIES_DIR}/main/" test -d "${BINARIES_DIR}/emus" && cp -r "${BINARIES_DIR}/emus/" "${BINARIES_DIR}/main/" if test -d "${BINARIES_DIR}/retroarch";then - cp -r "${BINARIES_DIR}/retroarch/" "${BINARIES_DIR}/main/" + rsync -avzh "${BINARIES_DIR}/retroarch/" "${BINARIES_DIR}/main/.retroarch/" ## Generate list of cores to be used CORES_DIR="${BINARIES_DIR}/retroarch/cores" for file in $CORES_DIR/*; do @@ -47,4 +47,7 @@ fi # Write CFW version to splash image convert board/miyoo/miyoo-boot.png -pointsize 12 -fill white -annotate +10+230 "v${CFW_RELEASE} ${CFW_VERSION} (${LIBC}) ${STATUS}" -alpha off -type truecolor -strip -define bmp:format=bmp4 -define bmp:subtype=RGB565 "${BINARIES_DIR}"/boot/miyoo-boot.bmp +# Generate MAIN NTFS partition +board/miyoo/scripts/ntfs.sh + support/scripts/genimage.sh ${1} -c board/miyoo/genimage-sdcard.cfg diff --git a/board/miyoo/scripts/ntfs.sh b/board/miyoo/scripts/ntfs.sh new file mode 100755 index 000000000..274c41af9 --- /dev/null +++ b/board/miyoo/scripts/ntfs.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +image="${BINARIES_DIR}/main.img" +label="MAIN" +mntdir=`mktemp -d` + +dd status=progress if=/dev/zero of=$image bs=5M count=128 && sync + +LOOPMOUNT=`sudo losetup --show --find ${image}` +mkfs.ntfs -Q -v -F -L ${label} ${image} +mount ${LOOPMOUNT} ${mntdir} +rsync -avzh "${BINARIES_DIR}/main/" ${mntdir} +umount ${mntdir} +sudo losetup -d ${LOOPMOUNT} \ No newline at end of file diff --git a/configs/miyoo_musl_defconfig b/configs/miyoo_musl_defconfig index 3f1525d03..ef8c79a7c 100644 --- a/configs/miyoo_musl_defconfig +++ b/configs/miyoo_musl_defconfig @@ -60,6 +60,8 @@ BR2_PACKAGE_DOSFSTOOLS=y BR2_PACKAGE_DOSFSTOOLS_FATLABEL=y BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT=y +BR2_PACKAGE_NTFS_3G=y +BR2_PACKAGE_NTFS_3G_NTFSPROGS=y BR2_PACKAGE_FATRESIZE=y BR2_PACKAGE_RETROARCH=y BR2_PACKAGE_LIBRETRO_CORE_INFO=y @@ -228,6 +230,7 @@ BR2_PACKAGE_OPKG=y BR2_PACKAGE_OPKG_UTILS=y BR2_PACKAGE_DIALOG=y BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y +BR2_PACKAGE_UTIL_LINUX_PARTX=y BR2_PACKAGE_NANO=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y diff --git a/configs/miyoo_uclibc_defconfig b/configs/miyoo_uclibc_defconfig index 3045cc0f3..8a9d84b11 100644 --- a/configs/miyoo_uclibc_defconfig +++ b/configs/miyoo_uclibc_defconfig @@ -59,6 +59,8 @@ BR2_PACKAGE_DOSFSTOOLS=y BR2_PACKAGE_DOSFSTOOLS_FATLABEL=y BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT=y +BR2_PACKAGE_NTFS_3G=y +BR2_PACKAGE_NTFS_3G_NTFSPROGS=y BR2_PACKAGE_FATRESIZE=y BR2_PACKAGE_RETROARCH=y BR2_PACKAGE_LIBRETRO_CORE_INFO=y @@ -205,6 +207,7 @@ BR2_PACKAGE_OPKG=y BR2_PACKAGE_OPKG_UTILS=y BR2_PACKAGE_DIALOG=y BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y +BR2_PACKAGE_UTIL_LINUX_PARTX=y BR2_PACKAGE_NANO=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y