From fa3ab0c237b76eed2a7ee5f56d47802adfdc5c3a Mon Sep 17 00:00:00 2001 From: Luka Perkov Date: Fri, 4 Oct 2013 03:45:52 +0000 Subject: [PATCH] kirkwood: add support for UBI (3.10.x) Signed-off-by: Luka Perkov SVN-Revision: 38301 --- target/linux/kirkwood/config-3.10 | 16 +++++++++++ target/linux/kirkwood/image/Makefile | 28 +++++++++++++++---- target/linux/kirkwood/image/ubinize.cfg | 13 +++++++++ .../kirkwood/patches-3.10/110-ib62x0.patch | 5 ++-- 4 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 target/linux/kirkwood/image/ubinize.cfg diff --git a/target/linux/kirkwood/config-3.10 b/target/linux/kirkwood/config-3.10 index 06051994c8..298870c5cb 100644 --- a/target/linux/kirkwood/config-3.10 +++ b/target/linux/kirkwood/config-3.10 @@ -46,6 +46,8 @@ CONFIG_CPU_PM=y CONFIG_CPU_TLB_FEROCEON=y CONFIG_CPU_USE_DOMAINS=y CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_PINCTRL is not set # CONFIG_DEBUG_USER is not set @@ -129,6 +131,8 @@ CONFIG_LEDS_GPIO=y # CONFIG_LEDS_REGULATOR is not set CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y CONFIG_M25PXX_USE_FAST_READ=y # CONFIG_MACH_D2NET_V2 is not set CONFIG_MACH_DLINK_KIRKWOOD_DT=y @@ -164,6 +168,11 @@ CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ORION=y CONFIG_MTD_OF_PARTS=y # CONFIG_MTD_SM_COMMON is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MV643XX_ETH=y CONFIG_MVEBU_CLK_CORE=y CONFIG_MVEBU_CLK_GATING=y @@ -236,6 +245,11 @@ CONFIG_SPI_ORION=y CONFIG_SPLIT_PTLOCK_CPUS=999999 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +# CONFIG_UBIFS_FS_XZ is not set +CONFIG_UBIFS_FS_ZLIB=y CONFIG_UID16=y CONFIG_UIDGID_CONVERTED=y CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" @@ -258,4 +272,6 @@ CONFIG_XZ_DEC_ARM=y CONFIG_XZ_DEC_BCJ=y CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 51af440d34..b3d25f56b0 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -8,21 +8,39 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk NAND_BLOCKSIZE := 2048:128k +UBIFS_OPTS := -m 2048 -e 126KiB -c 4096 -U +UBINIZE_OPTS := -m 2048 -p 128KiB -s 512 define Image/BuildKernel - cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage + $(CP) $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage + ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) $(CP) $(KDIR)/uImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs endif + + $(foreach board,$(BOARDS), + $(LINUX_DIR)/scripts/dtc/dtc \ + -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \ + -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts + ) endef -define Image/Build +define Image/InstallKernel + + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),) + $(INSTALL_DIR) $(TARGET_DIR)/boot + $(CP) $(KDIR)/uImage $(TARGET_DIR)/boot/ + endif + + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),) + $(INSTALL_DIR) $(TARGET_DIR)/boot $(foreach board,$(BOARDS), - $(LINUX_DIR)/scripts/dtc/dtc \ - -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \ - -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts ; + $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb $(TARGET_DIR)/boot/ ) + endif +endef +define Image/Build $(if $(Image/Build/$(1)), \ $(call Image/Build/$(1),$(1)), \ $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img \ diff --git a/target/linux/kirkwood/image/ubinize.cfg b/target/linux/kirkwood/image/ubinize.cfg new file mode 100644 index 0000000000..e4149ec7d7 --- /dev/null +++ b/target/linux/kirkwood/image/ubinize.cfg @@ -0,0 +1,13 @@ +[rootfs] +# Volume mode (other option is static) +mode=ubi +# Source image +image=root.ubifs +# Volume ID in UBI image +vol_id=0 +# Allow for dynamic resize +vol_type=dynamic +# Volume name +vol_name=rootfs +# Autoresize volume at first mount +vol_flags=autoresize diff --git a/target/linux/kirkwood/patches-3.10/110-ib62x0.patch b/target/linux/kirkwood/patches-3.10/110-ib62x0.patch index 7404decd7e..3659b9587b 100644 --- a/target/linux/kirkwood/patches-3.10/110-ib62x0.patch +++ b/target/linux/kirkwood/patches-3.10/110-ib62x0.patch @@ -34,10 +34,9 @@ }; - partition@700000 { -- label = "root"; -- reg = <0x0700000 0xf900000>; + partition@100000 { -+ label = "rootfs"; + label = "root"; +- reg = <0x0700000 0xf900000>; + reg = <0x100000 0xff00000>; }; - -- 2.30.2