diff --git a/README.md b/README.md index 9c4e742fdf..03e0b8f29c 100644 --- a/README.md +++ b/README.md @@ -585,8 +585,8 @@ make busybox-update-config # save the changes #### ../board/shredos/doimg.sh doimg.sh is a bash script, the main purpose of which is to generate the .img file located in output/images/. However it is also used to copy the pre-compiled .efi file and other files such as the shredos.ico, autorun.inf for Windows, README.txt. The contents of board/shredos/version.txt is also used to rename the .img file with version info and the current date and time. -#### ../board/shredos/version.txt -This file contains the version information as seen in the title on nwipe's title bar, i.e. '2021.08.2_22_x86-64_0.32.023'. This version ingformation is also used when naming the .img file in ../output/images/ /board/shredos/version.txt is manually updated for each new release of ShredOS. +#### ../board/shredos/fsoverlay/etc/shredos/version.txt +This file contains the version information as seen in the title on nwipe's title bar, i.e. '2021.08.2_22_x86-64_0.32.023'. This version ingformation is also used when naming the .img file in ../output/images/ ../board/shredos/fsoverlay/etc/shredos/version.txt is manually updated for each new release of ShredOS. #### ../board/shredos/fsoverlay/ This fsoverlay directory contains files and folders that are directly copied into the root filesystem of ShredOS. A example of this is the ../board/shredos/fsoverlay/etc/inittab file where the tty1 and tty2 virtual terminals are configured. This is where you will find the script `/usr/bin/nwipe_launcher` that automatically starts in tty1 after ShredOS has booted. If you want to place or overwrite a specific file in the root filesystem of ShredOS, the ../board/shredos/fsoverlay/ directory is one way of inserting your own files. diff --git a/board/shredos/doimg.sh b/board/shredos/doimg.sh index c99d8cb673..afabed9ad0 100755 --- a/board/shredos/doimg.sh +++ b/board/shredos/doimg.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -version=`cat board/shredos/version.txt` +version=`cat board/shredos/fsoverlay/etc/shredos/version.txt` cp "board/shredos/grub.cfg" "${BINARIES_DIR}/grub.cfg" || exit 1 cp "board/shredos/bootx64.efi" "${BINARIES_DIR}/bootx64.efi" || exit 1 @@ -13,6 +13,9 @@ cp "board/shredos/autorun.inf" "${BINARIES_DIR}/autorun.inf" || exit cp "board/shredos/README.txt" "${BINARIES_DIR}/README.txt" || exit 1 cp "board/shredos/shredos.ico" "${BINARIES_DIR}/shredos.ico" || exit 1 +# version.txt is used to help identify boot disc +cp "board/shredos/fsoverlay/etc/shredos/version.txt" "${BINARIES_DIR}/version.txt" || exit 1 + rm -rf "${BUILD_DIR}/genimage.tmp" || exit 1 genimage --rootpath="${TARGET_DIR}" --inputpath="${BINARIES_DIR}" --outputpath="${BINARIES_DIR}" --config="board/shredos/genimage.cfg" --tmppath="${BUILD_DIR}/genimage.tmp" || exit 1 diff --git a/board/shredos/fsoverlay/etc/shredos/version.txt b/board/shredos/fsoverlay/etc/shredos/version.txt new file mode 100644 index 0000000000..8bc78c4b85 --- /dev/null +++ b/board/shredos/fsoverlay/etc/shredos/version.txt @@ -0,0 +1 @@ +2023.08.2_25.1_x86-64_0.35 diff --git a/board/shredos/fsoverlay/usr/bin/archive_log.sh b/board/shredos/fsoverlay/usr/bin/archive_log.sh index aee2ce54ca..c516ceb8f4 100755 --- a/board/shredos/fsoverlay/usr/bin/archive_log.sh +++ b/board/shredos/fsoverlay/usr/bin/archive_log.sh @@ -1,11 +1,9 @@ #!/bin/bash # # This script will archive the nwipe log file/s, dmesg.txt files and PDF certificates -# to the first FAT32 formatted partition found, which should normally be the ShredOS -# USB flash drive. If there is more than one FAT32 drive this script will always -# archive to the first drive found. This is independant of the mode of operation, the -# log, dmesg and PDF files will always be written from ShredOS's RAM drive to the USB -# flash drive. +# to the first exFAT/FAT32 formatted partition found that is identified as having a +# matching /boot/version.txt file (ShredOS USB) as the booted ShredOS or in the case of +# Ventoy the version within the kernel filename that matches the booted ShredOS. # # It also checks whether /etc/nwipe/nwipe.conf and /etc/nwipe/customers.csv exist # on the USB flash drive and assuming mode 0, read (-r argument) has been selected will @@ -14,7 +12,7 @@ # /etc/nwipe/nwipe.conf and /etc/nwipe/customers.csv are copied from ShredOS's RAM # disc back to the USB flash drive, which is normally done on Nwipe exit. # -# Written by PartialVolume, a component of ShredOS - the disk eraser. +# Written by PartialVolume, archive_log.sh is a component of ShredOS - the disk eraser. exit_code=0 mode="" @@ -37,17 +35,17 @@ while getopts 'rw' opt; do esac done -# This is the temporary directory that the FAT32 drive is to be mounted on +# This is the temporary directory that the exFAT/FAT32 drive is to be mounted on archive_drive_directory="/archive_drive" # The nwipe logs that have been sent are moved into this directory in RAM disk. sent_directory="/sent" -# From all the drives on the system, find the first and probably only FAT32 partition -drive=$(fdisk -l | grep -i '/dev/*' | grep -i FAT32 | awk '{print $1}' | head -n 1) +# From all the drives on the system, try to locate the ShredOS boot disc +drive=$(find_shredos_boot_disc.sh) if [ "$drive" == "" ]; then - printf "archive_log.sh: No FAT32 formatted drive found, unable to archive nwipe log file\n" + printf "archive_log.sh: No ShredOS/Ventoy exFAT/FAT32 boot drive found, unable to archive nwipe log files to USB\n" exit 1 else printf "Archiving nwipe logs to $drive\n" @@ -70,9 +68,9 @@ if [ $status != 0 ] && [ $status != 32 ]; then printf "archive_log.sh: Unable to mount the FAT32 partition $drive to $archive_drive_directory\n" exit_code=3 else - printf "archive_log.sh: FAT32 partition $drive is now mounted to $archive_drive_directory\n" + printf "archive_log.sh: exFAT/FAT32 partition $drive is now mounted to $archive_drive_directory\n" - # Copy the dmesg.txt and PDF files over to the FAT32 partition + # Copy the dmesg.txt and PDF files over to the exFAT/FAT32 partition dmesg > dmesg.txt cp /dmesg.txt "$archive_drive_directory/" if [ $? != 0 ]; then @@ -81,7 +79,7 @@ else printf "archive_log.sh: Sucessfully copied dmesg.txt to $drive:/\n" fi - # Copy the PDF certificates over to the FAT32 partition + # Copy the PDF certificates over to the exFAT/FAT32 partition cp /nwipe_report_*pdf "$archive_drive_directory/" if [ $? != 0 ]; then printf "archive_log.sh: Unable to copy the nwipe_report...pdf file to the root of $drive:/\n" @@ -89,7 +87,7 @@ else printf "archive_log.sh: Sucessfully copied nwipe_report...pdf to $drive:/\n" fi - # Copy the nwipe log files over to the FAT32 partition + # Copy the nwipe log files over to the exFAT/FAT32 partition cp /nwipe_log* "$archive_drive_directory/" if [ $? != 0 ]; then printf "archive_log.sh: Unable to copy the nwipe log files to the root of $drive:/\n" diff --git a/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh b/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh new file mode 100755 index 0000000000..56d6f5e78d --- /dev/null +++ b/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# This program looks for any exfat or fat32 filesystems, it then +# examines the filesystem, looking for a kernel file or .img or .iso +# file that has the same version number as the booted ShredOS. Once +# the boot USB has been found this script outputs the drive name in +# the following form, example being /dev/sdc etc +# +version=$(cat /etc/shredos/version.txt) +drive_dir="boot_tmp" +drive="" + +# Create a directory to mount the USB stick onto. +test -d "$drive_dir" + if [ $? != 0 ] + then + mkdir "$drive_dir" + fi + +# Search for a supported filesystem, mount it and see if it could be our boot disc +fdisk -l | grep -i "exfat\|fat32" | awk '{print $1}' | head -n 1 | while read drive ; +do + mount $drive $drive_dir + + # Check for correct version of ShredOS on a vanilla ShredOS USB drive + test -f "$drive_dir/boot/version.txt" + if [ $? == 0 ] + then + version_on_USB=$(cat "$drive_dir/boot/version.txt") + if [ $version == $version_on_USB ] + then + printf "$drive" + umount $drive_dir + break; + fi + fi + + # Check for correct version of a ShredOS .img or .iso on a Ventoy USB drive + test -f "$drive_dir/shredos-$version"* + if [ $? == 0 ] + then + printf "$drive" + umount $drive_dir + break; + fi + + umount $drive_dir +done + diff --git a/board/shredos/genimage.cfg b/board/shredos/genimage.cfg index fc9dde4a27..e9bd75d561 100644 --- a/board/shredos/genimage.cfg +++ b/board/shredos/genimage.cfg @@ -3,6 +3,7 @@ image boot.vfat { extraargs = "-F 32 -n SHREDOS" file boot/grub/grub.cfg { image = 'grub.cfg' } file boot/shredos { image = 'bzImage' } + file boot/version.txt { image = 'version.txt' } file EFI/BOOT/bootx64.efi { image = 'bootx64.efi' } file EFI/BOOT/grub.cfg { image = 'grub.cfg' } file shredos.ico { image = 'shredos.ico' } diff --git a/board/shredos/kernel-6.4-defconfig.config b/board/shredos/kernel-6.4-defconfig.config index 7121ef9eef..f0657d6267 100644 --- a/board/shredos/kernel-6.4-defconfig.config +++ b/board/shredos/kernel-6.4-defconfig.config @@ -92,6 +92,9 @@ CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_SYSFB_SIMPLEFB=y CONFIG_GOOGLE_FIRMWARE=y +CONFIG_OF=y +CONFIG_OF_UNITTEST=y +CONFIG_OF_OVERLAY=y CONFIG_BLK_DEV_PCIESSD_MTIP32XX=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_NVME=y @@ -635,7 +638,43 @@ CONFIG_DRM_AST=y CONFIG_DRM_MGAG200=y CONFIG_DRM_QXL=y CONFIG_DRM_VIRTIO_GPU=y +CONFIG_DRM_CHIPONE_ICN6211=y +CONFIG_DRM_CHRONTEL_CH7033=y +CONFIG_DRM_DISPLAY_CONNECTOR=y +CONFIG_DRM_ITE_IT6505=y +CONFIG_DRM_LONTIUM_LT8912B=y +CONFIG_DRM_LONTIUM_LT9211=y +CONFIG_DRM_LONTIUM_LT9611=y +CONFIG_DRM_LONTIUM_LT9611UXC=y +CONFIG_DRM_ITE_IT66121=y +CONFIG_DRM_LVDS_CODEC=y +CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW=y +CONFIG_DRM_NWL_MIPI_DSI=y +CONFIG_DRM_NXP_PTN3460=y +CONFIG_DRM_PARADE_PS8622=y +CONFIG_DRM_PARADE_PS8640=y +CONFIG_DRM_SAMSUNG_DSIM=y +CONFIG_DRM_SIL_SII8620=y +CONFIG_DRM_SII902X=y +CONFIG_DRM_SII9234=y +CONFIG_DRM_SIMPLE_BRIDGE=y +CONFIG_DRM_THINE_THC63LVD1024=y +CONFIG_DRM_TOSHIBA_TC358762=y +CONFIG_DRM_TOSHIBA_TC358764=y +CONFIG_DRM_TOSHIBA_TC358767=y +CONFIG_DRM_TOSHIBA_TC358768=y +CONFIG_DRM_TOSHIBA_TC358775=y +CONFIG_DRM_TI_DLPC3433=y +CONFIG_DRM_TI_TFP410=y +CONFIG_DRM_TI_SN65DSI83=y +CONFIG_DRM_TI_SN65DSI86=y +CONFIG_DRM_TI_TPD12S015=y +CONFIG_DRM_ANALOGIX_ANX6345=y CONFIG_DRM_ANALOGIX_ANX78XX=y +CONFIG_DRM_ANALOGIX_ANX7625=y +CONFIG_DRM_I2C_ADV7511=y +CONFIG_DRM_CDNS_DSI=y +CONFIG_DRM_CDNS_MHDP8546=y CONFIG_DRM_ETNAVIV=y CONFIG_DRM_BOCHS=y CONFIG_DRM_CIRRUS_QEMU=y @@ -750,6 +789,7 @@ CONFIG_BACKLIGHT_GPIO=y CONFIG_BACKLIGHT_LV5207LP=y CONFIG_BACKLIGHT_BD6107=y CONFIG_BACKLIGHT_ARCXCNN=y +CONFIG_BACKLIGHT_LED=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y diff --git a/board/shredos/version.txt b/board/shredos/version.txt deleted file mode 100644 index bab34d369a..0000000000 --- a/board/shredos/version.txt +++ /dev/null @@ -1 +0,0 @@ -2023.08.2_25.0_x86-64_0.35 diff --git a/configs/shredos_defconfig b/configs/shredos_defconfig index 3c31aa7f9f..ce439266e9 100644 --- a/configs/shredos_defconfig +++ b/configs/shredos_defconfig @@ -5,7 +5,7 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY=y BR2_CPAN_MIRROR="http://cpan.metacpan.org" BR2_TARGET_GENERIC_HOSTNAME="shredos" -BR2_TARGET_GENERIC_ISSUE="Welcome to ShredOS www.github.com/PartialVolume/shredos" +BR2_TARGET_GENERIC_ISSUE="Welcome to ShredOS https://github.com/PartialVolume/shredos.x86_64" BR2_INIT_SYSV=y BR2_ROOTFS_MERGED_USR=y BR2_SYSTEM_BIN_SH_BASH=y diff --git a/package/nwipe/002-nwipe-banner-patch.sh b/package/nwipe/002-nwipe-banner-patch.sh index 939c67c58e..7df2fe39c1 100755 --- a/package/nwipe/002-nwipe-banner-patch.sh +++ b/package/nwipe/002-nwipe-banner-patch.sh @@ -1,3 +1,3 @@ -version=`cat ../../../board/shredos/version.txt` +version=`cat ../../../board/shredos/fsoverlay/etc/shredos/version.txt` sed -i "/banner/c\const char* banner = \"ShredOS v$version\";" ./src/version.c