[LEDE-DEV] [LEDE-DEV,1/3] fstools: add exfat filesystem support
Add exfat filesystem support for fstools so that the block can detect and show the information of stroage in exfat format. Signed-off-by: Rosy Song --- CMakeLists.txt | 1 + libblkid-tiny/blkidP.h | 12 libblkid-tiny/exfat.c | 155 ++ libblkid-tiny/libblkid-tiny.c | 87 libblkid-tiny/superblocks.h | 6 ++ 5 files changed, 261 insertions(+) create mode 100644 libblkid-tiny/exfat.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e855bd..8efa56a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ ADD_LIBRARY(blkid-tiny SHARED libblkid-tiny/ext.c libblkid-tiny/jffs2.c libblkid-tiny/vfat.c + libblkid-tiny/exfat.c libblkid-tiny/ntfs.c libblkid-tiny/hfs.c libblkid-tiny/swap.c diff --git a/libblkid-tiny/blkidP.h b/libblkid-tiny/blkidP.h index 1ba7673..a573166 100644 --- a/libblkid-tiny/blkidP.h +++ b/libblkid-tiny/blkidP.h @@ -557,4 +557,16 @@ extern size_t blkid_encode_to_utf8(int enc, unsigned char *dest, size_t len, #define BLKID_ENC_UTF16BE 0 #define BLKID_ENC_UTF16LE 1 +enum uuid_format { + UUID_DOS = 0, /* 4 bytes */ + UUID_NTFS = 1, /* 8 bytes */ + UUID_DCE = 2, /* 16 bytes */ + UUID_DCE_STRING = 3,/* 36 bytes (VOLUME_ID_UUID_SIZE) */ +}; + +enum endian { + LE = 0, + BE = 1 +}; + #endif /* _BLKID_BLKIDP_H */ diff --git a/libblkid-tiny/exfat.c b/libblkid-tiny/exfat.c new file mode 100644 index 000..8e69350 --- /dev/null +++ b/libblkid-tiny/exfat.c @@ -0,0 +1,155 @@ + /* + * Copyright (C) 1999 by Andries Brouwer + * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o + * Copyright (C) 2001 by Andreas Dilger + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2008 Karel Zak + * Copyright (C) 2012 S-G Bergh + * Copyright (C) 2018 rosysong + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#if 0 +#include "pt-mbr.h" +#endif + +#include "superblocks.h" + +#define EXFAT_SB_OFFSET0 +#define EXFAT_DIR_ENTRY_SZ 32 +#define EXFAT_MAX_DIR_ENTRIES 100 + +struct exfat_super_block { +/* 0x00 */ uint8_t boot_jump[3]; +/* 0x03 */ uint8_t fs_name[8]; +/* 0x0B */ uint8_t must_be_zero[53]; +/* 0x40 */ uint64_tpartition_offset; +/* 0x48 */ uint64_tvolume_length; +/* 0x50 */ uint32_tfat_offset; // Sector address of 1st FAT +/* 0x54 */ uint32_tfat_size; // In sectors +/* 0x58 */ uint32_tcluster_heap_offset;// Sector address of Data Region +/* 0x5C */ uint32_tcluster_count; +/* 0x60 */ uint32_troot_dir; // Cluster address of Root Directory +/* 0x64 */ uint8_t vol_serial_nr[4]; // Volume ID +/* 0x68 */ uint16_tfs_revision;// VV.MM +/* 0x6A */ uint16_tvol_flags; +/* 0x6C */ uint8_t bytes_per_sector; // Power of 2: 9 => 512, 12 => 4096 +/* 0x6D */ uint8_t sectors_per_cluster;// Power of 2 +/* 0x6E */ uint8_t nr_of_fats; // 2 for TexFAT +/* 0x6F */ // ... +} __attribute__((packed)); + +struct exfat_dir_entry { +/* 0x00 */ uint8_t entry_type; + union { + struct volume_label { +/* 0x01 */ uint8_t char_count; // Length of label +/* 0x02 */ uint16_tvol_label[11]; // UTF16 string without null termination +/* 0x18 */ uint8_t reserved[8]; +/* 0x20 */ } __attribute__((packed)) label; + struct volume_guid { +/* 0x01 */ uint8_t sec_count; +/* 0x02 */ uint16_tset_checksum; +/* 0x04 */ uint16_tflags; +/* 0x06 */ uint8_t vol_guid[16]; +/* 0x16 */ uint8_t reserved[10]; +/* 0x20 */ } __attribute__((packed)) guid; + } __attribute__((packed)) type; +} __attribute__((packed)); + +static int probe_exfat(blkid_probe pr, const struct blkid_idmag *mag) +{ + struct exfat_super_block *sb; + struct exfat_dir_entry *de; + unsigned char *vol_label = 0; + unsigned char *vol_serno = NULL; + unsignedsector_sz; + unsignedcluster_sz; + uint64_troot_dir_off; + unsignedcount; + unsignedneed_lbl_guid; + const char *version = "EXFAT"; + + // Primary super block + DBG(LOWPROBE, ul_debug("exFAT: probing at offset 0x%x", EXFAT_SB_OFFSET)); + sb =
[LEDE-DEV] [LEDE-DEV,2/3] fstools: fix potential memory leak
Fix potential memory leak in fstools Signed-off-by: Rosy Song --- libblkid-tiny/libblkid-tiny.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c index ccfaf63..12cab6f 100644 --- a/libblkid-tiny/libblkid-tiny.c +++ b/libblkid-tiny/libblkid-tiny.c @@ -282,7 +282,7 @@ int probe_block(char *block, struct blkid_struct_probe *pr) mag = &idinfos[i]->magics[0]; - while (mag->magic) { + while (mag && mag->magic) { int off = (mag->kboff * 1024) + mag->sboff; char magic[32] = { 0 }; -- 2.13.3 Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [LEDE-DEV, 3/3] fstools: fix lost mount point when first boot
When firmware is new flashed and reboot with a storage device plug in its usb interface. Though the filesystem is not ready (FS_STATE_UNKNOWN), the /dev/sda1 still mount on /mnt/sda1 by block-mount, then the system switching jffs... root@OpenWrt:~# dmesg .. [ 32.224522] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 [ 32.270514] jffs2_build_filesystem(): unlocking the mtd device... [ 32.278711] jffs2_build_filesystem(): erasing all blocks after the end marker... root@OpenWrt:~# mount .. /dev/sda1 on /mnt/sda1 type exfat (rw,relatime,fmask=,dmask=,allow_utime=0022,iocharset=utf8,namecase=0,errors=remount-ro) mountd(pid1314) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=30,minproto=5,maxproto=5,indirect) After few miniutes, when filesystem is ready (FS_STATE_READY, /overlay/.fs_state -> 2) the /dev/sda1 lost its mount point root@OpenWrt:~# dmesg ... [ 207.439407] jffs2: notice: (1336) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found. root@OpenWrt:~# mount .. **no /mnt/sda1 found** .. Signed-off-by: Rosy Song --- mount_root.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mount_root.c b/mount_root.c index dffb0a6..110e4fd 100644 --- a/mount_root.c +++ b/mount_root.c @@ -101,6 +101,7 @@ stop(int argc, char *argv[1]) static int done(int argc, char *argv[1]) { + int ret; struct volume *v = volume_find("rootfs_data"); if (!v) @@ -109,7 +110,15 @@ done(int argc, char *argv[1]) switch (volume_identify(v)) { case FS_NONE: case FS_DEADCODE: - return jffs2_switch(v); + ret = jffs2_switch(v); + /* + * Devices mounted under /mnt will lost their mount point(see switch2jffs()) + * if the filesystem's(/overlay) state is not FS_STATE_READY, + * this action can fix it. + */ + if (!access("/sbin/block", X_OK)) + system("/sbin/block mount"); + return ret; case FS_EXT4: case FS_F2FS: -- 2.13.3 Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [LEDE-DEV, 1/3] fstools: add exfat filesystem support
On 29/03/18 10:23, rosys...@rosinson.com wrote: Add exfat filesystem support for fstools so that the block can detect and show the information of stroage in exfat format. (...) Can an exfat implementation be legally distributed? -- Bas. ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [LEDE-DEV, 1/3] fstools: add exfat filesystem support
Hi, fstools will use the full libblkid if it is installed on the system, this should also enable support for all filesystems supported by the full libblkid. Adding more and more exotic stuff to libblkid-tiny will bloat the default fstools install for all users, so we should avoid that - imho. Regards, Jo ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] Question regarding kmod-ipt-offload and imagebuilder
Hi Felix, Regarding your commit ("build: include kmod-ipt-offload in default images") [1] By default, this package is only supported (and selectable) when the target device uses kernel 4.14. I've just tried this: - Checkout OpenWrt master - Select a target using kernel 4.9 (ar71xx) - Build it normally - Use Imagebuilder to customize the image and rebuild it. The imagebuilder logically fails, as package kmod-ipt-offload is required but not available. Is there any possibility to mark a package to be required within include/target.mk , but only when the kernel version matches some minimum/specific version? I know it's possible in the imagebuilder to de-select a package using the make command .. but it would be nicer to have a solution which does not require specifying this explicitly. Any idea? Thanks, Koen https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=905a3f249a261aa7fc162dd5ea184bd701044469 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] Question regarding kmod-ipt-offload and imagebuilder
On 2018-03-29 13:42, Koen Vandeputte wrote: > Hi Felix, > > Regarding your commit ("build: include kmod-ipt-offload in default > images") [1] > > By default, this package is only supported (and selectable) when the > target device uses kernel 4.14. > > > I've just tried this: > > - Checkout OpenWrt master > - Select a target using kernel 4.9 (ar71xx) > - Build it normally > - Use Imagebuilder to customize the image and rebuild it. > > The imagebuilder logically fails, as package kmod-ipt-offload is > required but not available. > > Is there any possibility to mark a package to be required within > include/target.mk , but only when the kernel version matches some > minimum/specific version? > I know it's possible in the imagebuilder to de-select a package using > the make command .. but it would be nicer to have a solution which does > not require specifying this explicitly. Could you please test this commit from my staging tree? http://git.openwrt.org/b2b70e8b62937ff2b1459e9095cb026fa9688fc4 Thanks, - Felix ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] mac80211: update request
Hello, Trying to add support of drivers/net/wireless/rsi/rsi91x driver in mac80211 we faced with problem, that the version of backports is quite old(2017-11-01), and at least one significant commit for rsi91x was later than this version: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git/commit/?id=e6b3b2ed3d270b3c7080c9cf7d28636dc74b0387 Without this commit driver is not building. Is there any possibility to update mac80211:backports version to more actual? Best regards, Evgeniy Didin ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] leds-apu2: add newer board names
After building coreboot myself, I discovered that the board names changed again - they now seem to be the same as before. https://github.com/pcengines/coreboot/commit/3578e9fb6dac753ec9365c88a8556ca1b90a8deb I guess the "PC Engines apuX" strings can be considered to be a bug on the PCEngines side then. Just ignore my patch. Once there is a binary release of a fixed version (probably 4.6.8), I can put a note on the apu2 wiki page. Sebastian ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev