1
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 /etc/fstab
:
/dev/mmcblk0p1 /data auto defaults 0 1
overlay /etc overlay x-systemd.requires=/data,lowerdir=/etc,upperdir=/data/etc,workdir=/data/work/etc 0 1
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, before systemd startup. What are the files that contains the mount /
operation ?
Thanks for your explanation. Where can I found this script in my development directory ? I'm looking for it for days. – grorel – 2019-12-04T10:27:56.783
OK, I just found it. It is in buildroot_directory/fs/cpio. I'll try to make some changes in it now to perform the overlay – grorel – 2019-12-04T12:12:52.510