hello,
even though it is not the best alternative for general purpose OS, it supports mini m8s ii hardware-devices fully . so I am trying to understand the Libreelec scripts. It is really good reference. so here is my approach:
Kernel first extracts initramfs then execute init script.
within init script prepare_sysroot() function mounts SYSTEM rootfs image as "ro, loop".
I am trying to change mount target from SYSTEM to /dev/mmcblk1p2 (rw) which have extracted rootfs.
I found extracted SYSTEM rootfs & initramfs.cpio under "LibreELEC/buildxxxx7.0.2.008/image" folder.
**********
prepare_sysroot() {
progress "Preparing system"
#if [ "$SYSTEM_TORAM" = "no" -o "$INSTALLED_MEMORY" -lt "$SYSTEM_TORAM_LIMIT" ]; then
#mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
#else
#cp /flash/$IMAGE_SYSTEM /dev/$IMAGE_SYSTEM
#mount_part "/dev/$IMAGE_SYSTEM" "/sysroot" "ro,loop"
#fi
mount_part "/dev/mmcblk1p2" "/sysroot" "rw" # 1.st attempt does not work
mount --move /storage /sysroot # 2.nd attempt does not work
mount --move /flash /sysroot/flash
#mount --move /storage /sysroot/storage
**********
scripts still generate images but I use new kernel.img and extracted rootfs in sdcard.
until now no luck, kernel hangs at 4th second like this: (I think it cannot change rootfs from ram to mmcblk1p2)
[ 4.268764@3] [<ffffffc001083da0>] el1_irq+0x60/0xc0
[ 4.273680@3] [<ffffffc0010e755c>] cpu_startup_entry+0x17c/0x1d0
[ 4.279632@3] [<ffffffc00108da10>] secondary_start_kernel+0x110/0x120
any help from someone who has insight kernel-initramfs-rootfs transitions would be appreciated, (I am reading ramfs-rootfs-initramfs.txt but it seems every system has it's own ways )
thanks,
EDIT:
It turns out, when I try to change init script inside initramfs.cpio through Archive Manager (Ubuntu), it changes cpio compression switches. So kernel cannot extract initramfs and halts. Instead I changed init file in http://LibreELEC.tv/packages/sysutils/busybox/scripts/init, deleted already built kernel, image etc, rerun make...and now i have rw LibreElec system booting.