Implement writable /root for users to keep data

This commit is contained in:
George Hilliard 2019-08-07 01:03:56 -05:00
parent dd718e3cdb
commit 2aa0662fcc
5 changed files with 52 additions and 2 deletions

View file

@ -1,6 +1,7 @@
flash w25q64 {
pebsize = 4096
numpebs = 2048
pebsize = 65536
lebsize = 65408
numpebs = 128
minimum-io-unit-size = 1
sub-page-size = 1
vid-header-offset = 64
@ -41,6 +42,15 @@ image flashdrive.img {
size = 65K
}
image persist.ubifs {
ubifs {
extraargs = "--compr=zlib --jrn-size=64KiB --log-lebs=2"
}
size=1280K
flashtype = w25q64
mountpoint = /root
}
image root.ubi {
ubi {}
partition kernel {
@ -59,6 +69,9 @@ image root.ubi {
image = flashdrive.img
read-only = true
}
partition persist {
image = persist.ubifs
}
}
image boot.vfat {

View file

@ -31,6 +31,7 @@ CONFIG_SUNXI_RSB=y
CONFIG_MTD=y
CONFIG_MTD_M25P80=y
CONFIG_MTD_SPI_NOR=y
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BLOCK=y
CONFIG_INPUT_POLLDEV=y
@ -95,6 +96,10 @@ CONFIG_PHY_SUN4I_USB=y
# CONFIG_DNOTIFY is not set
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
# CONFIG_UBIFS_FS_LZO is not set
# CONFIG_UBIFS_FS_XATTR is not set
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_FILE_DIRECT=y
# CONFIG_SQUASHFS_ZLIB is not set

View file

@ -1,3 +1,5 @@
#!/bin/sh
grep -q "GADGET_SERIAL" "${TARGET_DIR}/etc/inittab" \
|| echo '/dev/ttyGS0::respawn:/sbin/getty -L /dev/ttyGS0 0 vt100 # GADGET_SERIAL' >> "${TARGET_DIR}/etc/inittab"
grep -q "ubi0:persist" "${TARGET_DIR}/etc/fstab" \
|| echo 'ubi0:persist /root ubifs defaults 0 0' >> "${TARGET_DIR}/etc/fstab"

View file

@ -47,6 +47,7 @@ CONFIG_SPI_FLASH_ATMEL=y
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_PHY_SUN4I_USB=y
CONFIG_PINCTRL=y

View file

@ -0,0 +1,29 @@
commit f2b104aa68a0dff3f0bf6b481f9724722cb01939
Author: George Hilliard <thirtythreeforty@gmail.com>
Date: Wed Aug 7 00:35:20 2019 -0500
Prefix mountpoints with mp- to avoid conflict with "root"
Specifying an image with mountpoint "/root" would cause the mountpoint's
location to be "root", which conflicts with the location for the actual
filesystem root.
Fix this by appending a prefix.
Closes #67 on GitHub.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
diff --git a/genimage.c b/genimage.c
index ca2c6d6..aafd3b7 100644
--- a/genimage.c
+++ b/genimage.c
@@ -392,7 +392,7 @@ static struct mountpoint *add_mountpoint(const char *path)
path_sanitized = sanitize_path(path);
mp = xzalloc(sizeof(*mp));
mp->path = strdup(path);
- xasprintf(&mp->mountpath, "%s/%s", tmppath(), path_sanitized);
+ xasprintf(&mp->mountpath, "%s/mp-%s", tmppath(), path_sanitized);
list_add_tail(&mp->list, &mountpoints);
free(path_sanitized);