Skip to contentSkip to conversation

Introduced btrfs file-system with btrload command

PATCH New Adnan Ali 1 participant 2 messages Oct 13, 2013

Subsystems (4)
lore
Share & tools
lore

Adnan Ali

author
#0 lore raw

PATCH 1/2 Introduced btrfs file-system with btrload command

Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support.
This btrfs implementation is based on syslinux btrfs code.

v13:     Added pre-calculated crc for BE & LE
v11:     Mirro super block check.
v10:     patch problem reworked.
v5:      merged with master.
v4:      btrls command added.

[port of syslinux commit 269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d]

---
 Makefile                   |    1 +
 common/Makefile            |    1 +
 common/cmd_btr.c           |   65 +++
 fs/btrfs/Makefile          |   51 ++
 fs/btrfs/btrfs.c           | 1336 ++++++++++++++++++++++++++++++++++++++++++++
 fs/fs.c                    |   10 +
 include/btrfs.h            |  417 ++++++++++++++
 include/config_fallbacks.h |    4 +
 include/crc.h              |    5 +
 include/fs.h               |    1 +
 lib/Makefile               |    1 +
 lib/crc32_c.c              |  108 ++++
 12 files changed, 2000 insertions(+)
 create mode 100644 common/cmd_btr.c
 create mode 100644 fs/btrfs/Makefile
 create mode 100644 fs/btrfs/btrfs.c
 create mode 100644 include/btrfs.h
 create mode 100644 lib/crc32_c.c
Makefile +1 -0
index 55bd55c..bd7981d 100644
@@ -257,6 +257,7 @@ endif
 LIBS-$(CONFIG_OF_EMBED) += dts/libdts.o
 LIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS-y += fs/libfs.o \
+	fs/btrfs/libbtrfs.o \
 	fs/cbfs/libcbfs.o \
 	fs/cramfs/libcramfs.o \
 	fs/ext4/libext4fs.o \
common/Makefile +1 -0
index 719fc23..d1fae56 100644
@@ -73,6 +73,7 @@ COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
 COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
 COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o
+COBJS-$(CONFIG_CMD_BTR) += cmd_btr.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
 COBJS-$(CONFIG_CMD_CBFS) += cmd_cbfs.o
 COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
common/cmd_btr.c new file +65 -0

65 lines not on this page · raw message

fs/btrfs/Makefile new file +51 -0

51 lines not on this page · raw message

fs/btrfs/btrfs.c new file +1336 -0

1,336 lines not on this page · raw message

fs/fs.c +10 -0
index 6f5063c..b8c3603 100644
@@ -17,6 +17,7 @@
 #include <config.h>
 #include <common.h>
 #include <part.h>
+#include <btrfs.h>
 #include <ext4fs.h>
 #include <fat.h>
 #include <fs.h>
@@ -88,6 +89,15 @@ static struct fstype_info fstypes[] = {
 		.read = fs_read_sandbox,
 	},
 #endif
+#ifdef CONFIG_FS_BTR
+	{
+		.fstype = FS_TYPE_BTR,
+		.probe = btrfs_probe,
+		.close = btrfs_close,
+		.ls = btrfs_ls,
+		.read = btrfs_read_file,
+	},
+#endif
 	{
 		.fstype = FS_TYPE_ANY,
 		.probe = fs_probe_unsupported,
include/btrfs.h new file +417 -0

417 lines not on this page · raw message

include/config_fallbacks.h +4 -0
index bfb9680..28a0a66 100644
@@ -26,4 +26,8 @@
 #define CONFIG_EXT4_WRITE
 #endif
 
+#if defined(CONFIG_CMD_BTR) && !defined(CONFIG_FS_BTR)
+#define CONFIG_FS_BTR
+#endif
+
 #endif	/* __CONFIG_FALLBACKS_H */
include/crc.h +5 -0
index 10560c9..be3bf0b 100644
@@ -97,4 +97,9 @@ cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
 
 extern uint16_t cyg_crc16(unsigned char *s, int len);
 
+
+/* CRC calculate for btrfs file-system*/
+
+u32 crc32c_cal(u32 crc, const char *data, size_t length);
+
 #endif /* _SERVICES_CRC_CRC_H_ */
include/fs.h +1 -0
index b6d69e5..a8b97ea 100644
@@ -22,6 +22,7 @@
 #define FS_TYPE_FAT	1
 #define FS_TYPE_EXT	2
 #define FS_TYPE_SANDBOX	3
+#define FS_TYPE_BTR	4
 
 /*
  * Tell the fs layer which block device an partition to use for future
lib/Makefile +1 -0
index 86ca1a6..9518b72 100644
@@ -67,6 +67,7 @@ COBJS-$(CONFIG_SPL_NET_SUPPORT) += hashtable.o
 COBJS-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o
 endif
 COBJS-y += crc32.o
+COBJS-y += crc32_c.o
 COBJS-y += ctype.o
 COBJS-y += div64.o
 COBJS-y += linux_string.o
lib/crc32_c.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 Enable btrfs support in mx53loco config

Enable btrfs support in mx53loco config

---
 include/configs/mx53loco.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/configs/mx53loco.h +3 -1
index a4b610f..bf361a3 100644
@@ -56,6 +56,8 @@
 #define CONFIG_GENERIC_MMC
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_BTR
+#define CONFIG_CMD_FS_GENERIC
 #define CONFIG_DOS_PARTITION
 
 /* Eth Configs */
@@ -128,7 +130,7 @@
 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
 	"mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot}\0" \
 	"loadbootscript=" \
-		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source\0" \
 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
Signature · 1 line
1.7.9.5