Skip to content

Commit

Permalink
Make root readonly, create a partition for persistent data
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargjhaveri committed Aug 29, 2024
1 parent b4c85d8 commit a7bdb68
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
#
# Setup persistent storage
#

case "$1" in
start)
echo "Setup persistent storage..."
mkdir -p /persist/seedrng
mkdir -p /persist/bluetooth
;;
*)
echo "Usage: $0 {start}"
exit 1
esac

exit $?
Empty file.
40 changes: 40 additions & 0 deletions aa_wireless_dongle/board/raspberrypi/genimage.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
image boot.vfat {
vfat {
files = {
#BOOT_FILES#
}
}

size = 32M
}

image persist.ext4 {
name = "persist"
ext4 {
label = "persist"
use-mke2fs = true
}
size = 32M
}


image sdcard.img {
hdimage {
}

partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}

partition persist {
partition-type = 0x83
image = "persist.ext4"
}
}
5 changes: 5 additions & 0 deletions aa_wireless_dongle/board/raspberrypi/post-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

source board/raspberrypi/post-image.sh
9 changes: 9 additions & 0 deletions aa_wireless_dongle/board/raspberrypi/rootfs_overlay/etc/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 ro,noauto 0 1
/dev/mmcblk0p3 /persist ext4 defaults,noatime 0 2
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0

This file was deleted.

7 changes: 4 additions & 3 deletions aa_wireless_dongle/configs/raspberrypi0w_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero-w"

# Rootfs overlay
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi0w/rootfs_overlay"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/patches"

# Enable compressed kernel module support
Expand Down Expand Up @@ -72,9 +72,10 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="password"
# BR2_TARGET_GENERIC_GETTY is not set

# Filesystem / image
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=n
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi0w/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi0w/post-image.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/post-image.sh"
7 changes: 4 additions & 3 deletions aa_wireless_dongle/configs/raspberrypi3a_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3"

# Rootfs overlay
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi4/rootfs_overlay"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi4/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/patches"

# Enable compressed kernel module support
Expand Down Expand Up @@ -72,9 +72,10 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="password"
# BR2_TARGET_GENERIC_GETTY is not set

# Filesystem / image
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=n
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/post-image.sh"
7 changes: 4 additions & 3 deletions aa_wireless_dongle/configs/raspberrypi4_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b"

# Rootfs overlay
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi4/rootfs_overlay"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi4/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/patches"

# Enable compressed kernel module support
Expand Down Expand Up @@ -73,9 +73,10 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="password"
# BR2_TARGET_GENERIC_GETTY is not set

# Filesystem / image
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=n
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4/post-image.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/post-image.sh"
7 changes: 4 additions & 3 deletions aa_wireless_dongle/configs/raspberrypizero2w_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-zero-2-w"

# Rootfs overlay
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi0w/rootfs_overlay"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/common/rootfs_overlay $(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/rootfs_overlay"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/patches"

# Enable compressed kernel module support
Expand Down Expand Up @@ -72,9 +72,10 @@ BR2_TARGET_GENERIC_ROOT_PASSWD="password"
# BR2_TARGET_GENERIC_GETTY is not set

# Filesystem / image
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=n
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypizero2w/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypizero2w/post-image.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_AA_WIRELESS_DONGLE_PATH)/board/raspberrypi/post-image.sh"

0 comments on commit a7bdb68

Please sign in to comment.