summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-03-08 05:33:33 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2017-03-17 04:00:54 +0100
commit2d7388bc334ddb383ae275958d746c0622e515a3 (patch)
tree7ac1f78c268dd847fcac3116c1ae1d421050103e
parentd0ee6e2acec02180b8940269020f4034c805f83a (diff)
Implement UBIFS rootfs support
This implements UBIFS rootfs, enables it for mips targets and adds the necessary settings for rb532. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--mk/image.mk19
-rw-r--r--mk/rootfs.mk1
-rw-r--r--target/config/Config.in.rootfs9
-rw-r--r--target/linux/config/Config.in.flash23
-rw-r--r--target/mips/Makefile8
5 files changed, 59 insertions, 1 deletions
diff --git a/mk/image.mk b/mk/image.mk
index 6b704f200..84d6ab9a8 100644
--- a/mk/image.mk
+++ b/mk/image.mk
@@ -122,6 +122,7 @@ TARGET_KERNEL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_FS}-kernel
INITRAMFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}
ROOTFSSQUASHFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}.img
ROOTFSJFFS2= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-jffs2.img
+ROOTFSUBIFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-ubifs.img
ROOTFSTARBALL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}+kernel.tar.xz
ROOTFSUSERTARBALL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}.tar.xz
ROOTFSISO= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}.iso
@@ -191,6 +192,24 @@ ${FW_DIR}/${ROOTFSJFFS2}: ${TARGET_DIR}
PATH='${HOST_PATH}' mkfs.jffs2 $(ADK_JFFS2_OPTS) -q -r ${TARGET_DIR} \
--pad=$(ADK_TARGET_MTD_SIZE) -o ${FW_DIR}/${ROOTFSJFFS2} $(MAKE_TRACE)
+${FW_DIR}/${ROOTFSUBIFS}: ${TARGET_DIR}
+ ( \
+ PATH='${HOST_PATH}'; \
+ SP_SIZE='${ADK_TARGET_FLASH_SUBPAGE_SIZE}'; \
+ PG_SZIE='${ADK_TARGET_FLASH_PAGE_SIZE}'; \
+ LEB_SIZE=$$(((($$SP_SIZE + $$PG_SIZE) / $$PG_SIZE) * $$PG_SIZE)); \
+ mkfs.ubifs -r ${TARGET_DIR} \
+ -m $$PG_SIZE \
+ -e $$((${ADK_TARGET_FLASH_PEB_SIZE} - $$LEB_SIZE)) \
+ -c $$(((${ADK_TARGET_MTD_SIZE} / $$LEB_SIZE))) \
+ -o ${FW_DIR}/rootfs.ubifs; \
+ cd ${FW_DIR} && ubinize -o $@ \
+ -p ${ADK_TARGET_FLASH_PEB_SIZE} \
+ -m ${ADK_TARGET_FLASH_PAGE_SIZE} \
+ -s ${ADK_TARGET_FLASH_SUBPAGE_SIZE} \
+ "${ADK_TOPDIR}/target/${ADK_TARGET_ARCH}/${ADK_TARGET_SYSTEM}/ubinize.cfg"; \
+ ) $(MAKE_TRACE)
+
createinitramfs: ${STAGING_TARGET_DIR}/${INITRAMFS}_list
${SED} 's/.*CONFIG_\(RD_\|BLK_DEV_INITRD\|INITRAMFS_\).*//' \
${LINUX_DIR}/.config
diff --git a/mk/rootfs.mk b/mk/rootfs.mk
index 027c671b6..154896036 100644
--- a/mk/rootfs.mk
+++ b/mk/rootfs.mk
@@ -58,6 +58,7 @@ $(eval $(call rootfs_template,initramfspiggyback,INITRAMFSPIGGYBACK,rootfstype=t
$(eval $(call rootfs_template,initramfsarchive,INITRAMFSARCHIVE,rootfstype=tmpfs))
$(eval $(call rootfs_template,squashfs,SQUASHFS,$(MTDDEV) rootfstype=squashfs))
$(eval $(call rootfs_template,yaffs,YAFFS,$(MTDDEV)))
+$(eval $(call rootfs_template,ubifs,UBIFS,ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs))
$(eval $(call rootfs_template,jffs2,JFFS2,$(MTDDEV) rootfstype=jffs2))
$(eval $(call rootfs_template,nfsroot,NFSROOT,root=/dev/nfs ip=dhcp))
$(eval $(call rootfs_template,encrypted,ENCRYPTED))
diff --git a/target/config/Config.in.rootfs b/target/config/Config.in.rootfs
index c24535f01..335a4547f 100644
--- a/target/config/Config.in.rootfs
+++ b/target/config/Config.in.rootfs
@@ -87,6 +87,15 @@ config ADK_TARGET_ROOTFS_YAFFS
help
Root filesystem on NAND flash with YAFFS2.
+config ADK_TARGET_ROOTFS_UBIFS
+ bool "UBIFS root filesystem (NAND)"
+ select ADK_KERNEL_UBIFS_FS
+ select ADK_HOST_NEED_MTD_UTILS
+ select ADK_HOST_NEED_KERNEL2MINOR
+ depends on ADK_TARGET_WITH_NAND
+ help
+ Root filesystem on NAND flash with UBI.
+
config ADK_TARGET_ROOTFS_NFSROOT
bool "NFS root"
select ADK_KERNEL_NETWORK_FILESYSTEMS
diff --git a/target/linux/config/Config.in.flash b/target/linux/config/Config.in.flash
index 3cf3a15ff..159e4aa45 100644
--- a/target/linux/config/Config.in.flash
+++ b/target/linux/config/Config.in.flash
@@ -163,9 +163,30 @@ config ADK_TARGET_MTD_SIZE
int
depends on ADK_TARGET_SYSTEM_QEMU_MICROBLAZE_S3ADSP1800 \
|| ADK_TARGET_SYSTEM_QEMU_MICROBLAZE_ML605 \
- || ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
+ || ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9 \
+ || ADK_TARGET_SYSTEM_MIKROTIK_RB532
default "16777216" if ADK_TARGET_SYSTEM_QEMU_MICROBLAZE_S3ADSP1800
default "33554432" if ADK_TARGET_SYSTEM_QEMU_MICROBLAZE_ML605
+ default "134217728" if ADK_TARGET_SYSTEM_MIKROTIK_RB532
default "0"
+config ADK_TARGET_FLASH_PEB_SIZE
+ int
+ default 131072 if ADK_TARGET_SYSTEM_MIKROTIK_RB532
+ help
+ Physical Erase Block size.
+
+config ADK_TARGET_FLASH_PAGE_SIZE
+ int
+ default 2048 if ADK_TARGET_SYSTEM_MIKROTIK_RB532
+ help
+ Minimum input/output size.
+
+config ADK_TARGET_FLASH_SUBPAGE_SIZE
+ int
+ default 512 if ADK_TARGET_SYSTEM_MIKROTIK_RB532
+ default ADK_TARGET_FLASH_PAGE_SIZE
+ help
+ Size of NAND sub-pages (if supported).
+
endmenu
diff --git a/target/mips/Makefile b/target/mips/Makefile
index bb30049f1..6f0bd728c 100644
--- a/target/mips/Makefile
+++ b/target/mips/Makefile
@@ -87,6 +87,11 @@ else
@echo 'sudo dd if=$(FW_DIR)/disk.img of=/dev/sdX bs=2048k'
endif
endif
+ifeq ($(ADK_TARGET_FS),ubifs)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo 'The UBI image is: ${FW_DIR}/${ROOTFSUBIFS}'
+endif
# image creation and kernel install
kernel-strip:
@@ -121,3 +126,6 @@ endif
ifeq ($(ADK_TARGET_FS),yaffs)
imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
endif
+ifeq ($(ADK_TARGET_FS),ubifs)
+imageinstall: $(FW_DIR)/$(ROOTFSUBIFS) targethelp
+endif