img for booting from SD

  • I have a question about amlogic images for booting from SD. Is the image different then those to flash your firmware.

    I tried to boot a regular image (for flashing) from SD, so not the sd-images from Kszaq or Balbes150. I get the kernel booting, but then it complaints about the the fact the 2nd partition is corrupted and it needs to do a chkfs, what doesn't work as the filesystem is read only. I tried with different sd cards even a new one and it's all the same. My filesystem is fat16 for the BOOT partition and ext4 for the DISK partition. If I do the md5sum check, the md5sum is correct.

    I checked Balbes sources on github and don't see any differences in the mkimage script, or it should be another script that I don't know. I build the sources using 'make amlpkg', or should I use 'make image'? According me it shouldn't be different or does it?

    My s805_autoscript works as if I leave the disk=LABEL=DISK away, the kernel boots and then complaints about not finding the 2nd partition. With the disk=LABEL=DISK, it does find the 2nd partition (mmvblk0p2) and complaints about the fact the filesystem is corrupted.

    The only thing I assume can be the problem is the fact I copy the s805_autoscript to the sd-card after burning the image to it.

  • Seems it just the same image, due to some reason it works with a usb stick and not with a SD-card. I tried different SD-cards with all the same result. Somebody an idea why I get a filesystem corruption error on a SD-card and with the same image on a usb stick I don't have the error and the device boots fine.

  • This is a known problem of poor compatibility, SD card slot and built-in card reader. I know of only one way to solve is to find a working SD card (which would normally work with a particular instance of TV box).
    You can try to patch the kernel to improve the drivers for the SD card.

  • Balbes,

    I tried different sd-card readers, different sd-cards and different ways, burning with dd, burning with etcher, etc.

    The strange thing is that your builds work on the same sd-cards with the same readers and the same burning tools. I even burned your image to sd, booted from it and upgraded it with my KERNEL and SYSTEM files. result -> 2nd partition is corrupted. Regarding me there is some setting that is wrong, at the other side its strange it doesn't happen with the usb drive.

    I'm checking my scripts and patches vs yours to see if there is something different that can explain it.

  • I use the LE8 sources from Demetris and used your s805_autoscript, replacing the LABEL's to LIBREELEC and LIBREELEC_DISK. I use the mkimage command as mentioned on your github page.
    I'm not at home now, I can specify this evening.

  • This is the content of mu s805_autoscript:if test ${bootfromrecovery} = 1; then setenv bootfromrecovery 0; saveenv; run update; fi;
    if test ${bootfromnand} = 1; then setenv bootfromnand 0; saveenv; run storeboot; fi;
    setenv bootrootfs " boot=LABEL=LIBREELEC disk=LABEL=LIBREELEC_DISK BOOT_IMAGE=kernel.img "
    setenv cecconfig cecf
    setenv bootargs ${bootrootfs} ${bootargs}
    setenv le_usb "if fatload usb 0 ${loadaddr} kernel.img; then bootm ${loadaddr}; fi;"
    setenv le_sd "if fatload mmc 0 ${loadaddr} kernel.img; then bootm ${loadaddr}; fi;"
    run le_usb
    run le_sd


    compiled with:
    mkimage -C none -A arm -T script -d s805_autoscript.txt s805_autoscript

    This is the output from 'cat s805_autoscript':

    'V��2X��"��E�if test ${bootfromrecovery} = 1; then setenv bootfromrecovery 0; saveenv; run update; fi;
    if test ${bootfromnand} = 1; then setenv bootfromnand 0; saveenv; run storeboot; fi;
    setenv bootrootfs " boot=LABEL=LIBREELEC disk=LABEL=LIBREELEC_DISK BOOT_IMAGE=kernel.img "
    setenv cecconfig cecf
    setenv bootargs ${bootrootfs} ${bootargs}
    setenv le_usb "if fatload usb 0 ${loadaddr} kernel.img; then bootm ${loadaddr}; fi;"
    setenv le_sd "if fatload mmc 0 ${loadaddr} kernel.img; then bootm ${loadaddr}; fi;"
    run le_usb
    run le_sd

    Edited once, last by roel (February 22, 2017 at 7:42 PM).

  • For such a script s805_autoscript necessary, that would be the content platform_ini had such a form
    Variables in the script and the file platform_ini interrelated.
    ------------------------------------------------------------

    # Parse command line arguments
    for arg in $(cat /proc/cmdline); do
    case $arg in
    hdmitx=*)
    hdmitx="${arg#*=}"
    ;;
    hdmimode=*)
    hdmimode="${arg#*=}"
    ;;
    BOOT_IMAGE=*)
    BOOT_IMAGE="${arg#*=}"
    ;;
    boot=*)
    boot="${arg#*=}"
    ;;
    disk=*)
    disk="${arg#*=}"
    ;;
    esac
    done

    # Add information where to run LibreELEC from
    if [ -z "$BOOT_IMAGE" -o -z "$boot" -o -z "$disk" ]; then
    cmdline=$(cat /proc/cmdline)
    cmdline="$cmdline BOOT_IMAGE=/dev/boot boot=/dev/system disk=/dev/data"
    echo "$cmdline" > /proc/cmdline
    fi

    ---------------------------------------------------------------