diff --git a/buildroot-external/rootfs-overlay/etc/fstab b/buildroot-external/rootfs-overlay/etc/fstab index 66eb28a8..ff9c5a7a 100644 --- a/buildroot-external/rootfs-overlay/etc/fstab +++ b/buildroot-external/rootfs-overlay/etc/fstab @@ -9,4 +9,3 @@ tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 sysfs /sys sysfs defaults 0 0 #tmpfs /var/log tmpfs defaults 0 0 tmpfs /var/tmp tmpfs defaults 0 0 -tmpfs /ramdisk tmpfs rw,nodev,nosuid,size=20M 0 0 diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/ramdisk.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/ramdisk.mount new file mode 100644 index 00000000..74769558 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/ramdisk.mount @@ -0,0 +1,16 @@ +[Unit] +Description=OVOS ZRAM ramdisk +DefaultDependencies=no +Requires=zram-ramdisk.service +After=zram-ramdisk.service +Before=umount.target +Conflicts=umount.target + +[Mount] +What=/dev/zram1 +Where=/ramdisk +Type=ext4 +Options=nobarrier,strictatime,nosuid,nodev + +[Install] +WantedBy=local-fs.target diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-ramdisk.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-ramdisk.service new file mode 100644 index 00000000..917e6d55 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-ramdisk.service @@ -0,0 +1,15 @@ +[Unit] +Description=OVOS ZRAM ramdisk +DefaultDependencies=no +Before=ramdisk.mount +RefuseManualStart=true +RefuseManualStop=true + +[Service] +Type=oneshot +ExecStart=/usr/libexec/ovos-zram -t fs -m ramdisk -s 20M +RemainAfterExit=true +StandardOutput=null + +[Install] +WantedBy=ovos-zram.target diff --git a/buildroot-external/rootfs-overlay/usr/libexec/ovos-zram b/buildroot-external/rootfs-overlay/usr/libexec/ovos-zram index e6d065be..55ba0fc9 100755 --- a/buildroot-external/rootfs-overlay/usr/libexec/ovos-zram +++ b/buildroot-external/rootfs-overlay/usr/libexec/ovos-zram @@ -35,7 +35,7 @@ while [ "$1" != "" ]; do done # Valide Type -if [ "$TYPE" != "swap" ]; then +if [ "$TYPE" != "swap" ] && [ "$TYPE" != "fs" ]; then echo "[Error] Type unknown!" exit 1 fi @@ -43,8 +43,8 @@ fi # Lookup device if [ "$TYPE" = "swap" ]; then DEVICE="/dev/zram0" -#elif [ "$MOUNT" = "var" ]; then -# DEVICE="/dev/zram1" +elif [ "$MOUNT" = "ramdisk" ]; then + DEVICE="/dev/zram1" #elif [ "$MOUNT" = "tmp" ]; then # DEVICE="/dev/zram2" else @@ -64,3 +64,8 @@ zramctl "$DEVICE" -s "$SIZE" -a lz4 if [ "$TYPE" = "swap" ]; then mkswap -L "ovos-zramswap" "$DEVICE" fi + +# FileSystem +if [ "$TYPE" = "fs" ]; then + mkfs.ext4 -L "ovos-$MOUNT" -O ^has_journal "$DEVICE" +fi