11-20-2019, 05:50 PM
(11-20-2019, 02:09 PM)Arglebargle Wrote:(11-19-2019, 10:00 PM)iav Wrote: How can I set up Ubuntu to emmc with btrfs filesystem? Sumply boot from sdcard, format rootfs on emmc to btrfs and then copy all files from sdcard rootfs to emmc rootfs will be not enough, propose?
There are extra steps but you've got the right idea.
Some things that are important: in theory BSP kernel u-boot can directly boot a btrfs partition as long as it doesn't use compression. So if you don't care about compression you *should* be able to just flash Ubuntu to the emmc, flash mrfixit's u-boot with sd-booting capability to the emmc, convert the root filesystem to btrfs and then edit /boot/extlinux/extlinux.conf to change rootfstype and rootflags and be able to boot. You'll want to update /etc/default/extlinux after that to match your root filesystem configuration from the hand-modified /boot/extlinux/extlinux.conf so that you don't break booting on a kernel upgrade. /usr/local/sbin/update-extlinux.sh regenerates /boot/extlinux/extlinux.conf using /etc/default/extlinux as a template for kernel command-line parameters.
Also note: you should mount the emmc root filesystem and `touch /var/lib/rock64/resized` on it to prevent the ext4 resize script from puking on your drive on the first boot. You'll need to resize the partition manually too, read /usr/local/sbin/resize_filesystem.sh to see how to do that for ext4 before converting or just install gparted and use that.
I wouldn't do this though. You gain a lot by using compression with btrfs on a device with very slow (sd) or mildly-slow (emmmc) storage and you'll reduce nand wear significantly as well.
If you wait a bit I'll write up a guide and/or script installing ayufan's image to a btrfs root filesystem with extra niceties. I started typing out the steps below and I think it warrants its own post because it's going to be fairly involved.