I'm working on an embedded device with an arm cortex A9. The kernel version is 4.16.0 and is generated by buildroot 2018.05. The storage memory is an mmc with several partition. U-boot reads the uImage in one partition and starts the kernel. The filesystem is included in the kernel image and is loaded at startup in an initramfs (config : BR2_TARGET_ROOTFS_INITRAMFS).
I want to use an overlayfs to use a folder (in the mmc) as a 'user' filesystem, mounted onto
I already tried succesfully to overlay
/etc with a directory named
/data/etc by adding these lines to the
/dev/mmcblk0p1 /data auto defaults 1 2 overlay /etc overlay x-systemd.requires=/data,lowerdir=/etc,upperdir=/data/etc,workdir=/data/work/etc 0 0
This is working, but the overlay is mounted after systemd has already launch its sevices. So the network configuration for example is the one in the uImage and not the one in my
user filesystem. I'd like to mount the overlay before lauching systemd, just after
/ is mounted.
I have understood that at startup, the system creates a first memory space in ram and then extracts the cpio image in it. Then
/ is mounted there and the system launches the first program :
systemd:/sbin/init with the PID 1. Is my understanding right ?
I have read lots of article and Q&A website but I still do not understand where I have to make the changes to perform my overlay at boot time. What are the files that contains the
mount / operation ?