From b358e26252b1809f0e319157c76275038d26e815 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Mon, 10 Jul 2023 09:32:40 +0200 Subject: [PATCH] add settings to enable readonly fs --- conf/layer.conf | 3 +-- recipes-core/dropbear/files/default | 2 +- recipes-core/init-ifupdown/files/interfaces | 3 +++ recipes-core/init-ifupdown/init-ifupdown_%.bbappend | 6 ++++++ recipes-diya/diya-overlay/files/80_diya | 6 ++++-- recipes-diya/diya-overlay/files/confd | 6 +++--- recipes-diya/diya-overlay/files/expandfs.sh | 8 ++++---- recipes-extended/sudo/sudo_%.bbappend | 4 ++++ wic/rpi.wks.in | 6 +++++- 9 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 recipes-core/init-ifupdown/files/interfaces create mode 100644 recipes-extended/sudo/sudo_%.bbappend diff --git a/conf/layer.conf b/conf/layer.conf index 2d86cd0..a0456df 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -15,8 +15,7 @@ LAYERSERIES_COMPAT_meta-rpi-diya = "mickledore" PACKAGE_CLASSES = "package_ipk" INHERIT += "rm_work" -EXTRA_IMAGE_FEATURES ?= " ssh-server-dropbear " -# disable readonly fs read-only-rootfs +EXTRA_IMAGE_FEATURES ?= " ssh-server-dropbear read-only-rootfs " # ssh-server-dropbear DISTRO_FEATURES:append := " vc4-gfx opengl " # DISTRO_FEATURES:append := " vc4-gfx opengl directfb " diff --git a/recipes-core/dropbear/files/default b/recipes-core/dropbear/files/default index eb2d1fd..3b1c11b 100644 --- a/recipes-core/dropbear/files/default +++ b/recipes-core/dropbear/files/default @@ -1,2 +1,2 @@ DROPBEAR_EXTRA_ARGS="-w" -DROPBEAR_RSAKEY_DIR=/home/diya/etc/dropbear \ No newline at end of file +DROPBEAR_RSAKEY_DIR=/var/etc/dropbear \ No newline at end of file diff --git a/recipes-core/init-ifupdown/files/interfaces b/recipes-core/init-ifupdown/files/interfaces new file mode 100644 index 0000000..9a3ded6 --- /dev/null +++ b/recipes-core/init-ifupdown/files/interfaces @@ -0,0 +1,3 @@ +allow-hotplug wlan0 +iface wlan0 inet dhcp + wpa-conf /var/etc/network/wpa_supplicant.conf \ No newline at end of file diff --git a/recipes-core/init-ifupdown/init-ifupdown_%.bbappend b/recipes-core/init-ifupdown/init-ifupdown_%.bbappend index e3e193e..d06d6a4 100644 --- a/recipes-core/init-ifupdown/init-ifupdown_%.bbappend +++ b/recipes-core/init-ifupdown/init-ifupdown_%.bbappend @@ -1,3 +1,9 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI += "file://interfaces" + do_install:append () { rm ${D}/etc/network/interfaces + install -d ${D}/var/etc/ + install -d ${D}/var/etc/network + install -m 0644 ${WORKDIR}/interfaces ${D}/var/etc/network } \ No newline at end of file diff --git a/recipes-diya/diya-overlay/files/80_diya b/recipes-diya/diya-overlay/files/80_diya index 329d73d..95f6951 100644 --- a/recipes-diya/diya-overlay/files/80_diya +++ b/recipes-diya/diya-overlay/files/80_diya @@ -1,2 +1,4 @@ -l root root 0644 /etc/network/interfaces /home/diya/etc/network/interfaces -l root root 0644 /etc/dropbear /home/diya/etc/dropbear +d root root 0755 /var/etc/network none +d root root 0755 /var/etc/dropbear none +l root root 0644 /etc/network/interfaces /var/etc/network/interfaces +l root root 0644 /etc/dropbear /var/etc/dropbear diff --git a/recipes-diya/diya-overlay/files/confd b/recipes-diya/diya-overlay/files/confd index 145ffaa..3cfabf8 100644 --- a/recipes-diya/diya-overlay/files/confd +++ b/recipes-diya/diya-overlay/files/confd @@ -25,9 +25,9 @@ case "$1" in chown -R diya:diya /home/diya rm /boot/home_partition_should_be_formated fi - if [ -e "/boot/install" ];then - cp -rf /boot/install/* /home/diya - rm -rf /boot/install + if [ -e "/boot/wpa_supplicant.conf" ];then + install -m 0644 /boot/wpa_supplicant.conf /var/etc/network + rm /boot/wpa_supplicant.conf reboot fi # display information diff --git a/recipes-diya/diya-overlay/files/expandfs.sh b/recipes-diya/diya-overlay/files/expandfs.sh index 8630960..5749e18 100644 --- a/recipes-diya/diya-overlay/files/expandfs.sh +++ b/recipes-diya/diya-overlay/files/expandfs.sh @@ -1,6 +1,6 @@ #! /bin/sh line=$( -sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk0 | grep /dev/mmcblk0p3 +sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk0 | grep /dev/mmcblk0p4 p q EOF @@ -18,11 +18,11 @@ fi echo "Expanding the partition" sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk0 -d -3 +d # delete partition +4 # number 4 n # new partition p # primary partition -3 # partition number 3 +4 # partition number 4 $start_sector # default - end of disk p # print the in-memory partition table diff --git a/recipes-extended/sudo/sudo_%.bbappend b/recipes-extended/sudo/sudo_%.bbappend new file mode 100644 index 0000000..1e3a036 --- /dev/null +++ b/recipes-extended/sudo/sudo_%.bbappend @@ -0,0 +1,4 @@ +do_install:append() { + # grant all permission to sudo group + sed -i 's/^#\s*\(%sudo\s*ALL=(ALL:ALL)\s*ALL\)/\1/' ${D}/${sysconfdir}/sudoers +} \ No newline at end of file diff --git a/wic/rpi.wks.in b/wic/rpi.wks.in index 5ae063d..2412090 100644 --- a/wic/rpi.wks.in +++ b/wic/rpi.wks.in @@ -2,7 +2,11 @@ # long-description: Creates a partitioned SD card image for use with # Raspberry Pi. Boot files are located in the first vfat partition. -part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 50 +part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 32 +# read only roofs part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size 150 +# modifiable configurations stored in /var/etc +part /var/etc --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/var/etc --ondisk mmcblk0 --fstype=ext4 --label home --align 1024 --size 32 +# home partition part /home --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/home --ondisk mmcblk0 --fstype=ext4 --label home --align 1024 --size 16 # part /home --ondisk mmcblk0 --fstype=vfat --label music --active --align 1024 --size 16 \ No newline at end of file