wok rev 17267

Add linux-romfs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 23 18:05:56 2014 +0200 (2014-10-23)
parents 1f00b27b3afb
children 0d2eae483216
files linux-romfs/receipt linux/receipt linux/stuff/linux-romfs.u linux/stuff/linux-slitaz.config linux/stuff/linux-slitaz.config64 linux64-romfs/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-romfs/receipt	Thu Oct 23 18:05:56 2014 +0200
     1.3 @@ -0,0 +1,42 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="linux-romfs"
     1.7 +VERSION="3.2.53"
     1.8 +CATEGORY="base-system"
     1.9 +SHORT_DESC="The Linux kernel romfs module."
    1.10 +MAINTAINER="devel@slitaz.org"
    1.11 +LICENSE="GPL2"
    1.12 +DEPENDS="linux"
    1.13 +WANTED="linux"
    1.14 +WEB_SITE="http://www.kernel.org/"
    1.15 +CONFIG_FILES="/etc/filesystems"
    1.16 +
    1.17 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.18 +genpkg_rules()
    1.19 +{
    1.20 +    local path
    1.21 +    path=lib/modules/$VERSION-slitaz/kernel
    1.22 +    mkdir -p $fs/$path $fs/etc
    1.23 +    export src install
    1.24 +    $wanted_stuff/list_modules.sh fs/${PACKAGE#*-} | while read module; do
    1.25 +    	dir=$path/$(dirname $module)
    1.26 +    	[ -d $fs/$dir ] || mkdir -p $fs/$dir
    1.27 +        cp -a $install/$path/$module $fs/$dir
    1.28 +    done
    1.29 +    touch $fs/etc/filesystems
    1.30 +}
    1.31 +
    1.32 +# Post install/remove commands for Tazpkg.
    1.33 +post_install()
    1.34 +{
    1.35 +	grep -qs ^${PACKAGE#*-}$ $1/etc/filesystems || \
    1.36 +		echo "${PACKAGE#*-}" >> $1/etc/filesystems
    1.37 +	chroot "$root/" depmod -a $VERSION-slitaz
    1.38 +}
    1.39 +
    1.40 +post_remove()
    1.41 +{
    1.42 +	sed -i "/^${PACKAGE#*-}\$/d" $1/etc/filesystems
    1.43 +	chroot "$root/" depmod -a $VERSION-slitaz
    1.44 +}
    1.45 +
     2.1 --- a/linux/receipt	Thu Oct 23 11:06:43 2014 +0200
     2.2 +++ b/linux/receipt	Thu Oct 23 18:05:56 2014 +0200
     2.3 @@ -115,6 +115,7 @@
     2.4  $PACKAGE-freeinitrd.u
     2.5  $PACKAGE-subroot.u
     2.6  $PACKAGE-CVE-2013-2929.u
     2.7 +$PACKAGE-romfs.u
     2.8  aufs3-base.patch
     2.9  aufs3-standalone.patch
    2.10  aufs3-loopback.patch
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/linux/stuff/linux-romfs.u	Thu Oct 23 18:05:56 2014 +0200
     3.3 @@ -0,0 +1,98 @@
     3.4 +--- linux-3.2.53/fs/romfs/super.c
     3.5 ++++ linux-3.2.53/fs/romfs/super.c
     3.6 +@@ -74,6 +74,8 @@
     3.7 + #include <linux/uaccess.h>
     3.8 + #include "internal.h"
     3.9 + 
    3.10 ++#define MS_ROMFS_WITH_DATE	MS_VERBOSE
    3.11 ++
    3.12 + static struct kmem_cache *romfs_inode_cachep;
    3.13 + 
    3.14 + static const umode_t romfs_modemap[8] = {
    3.15 +@@ -302,6 +304,7 @@
    3.16 + 	unsigned nextfh;
    3.17 + 	int ret;
    3.18 + 	umode_t mode;
    3.19 ++	unsigned long spec;
    3.20 + 
    3.21 + 	/* we might have to traverse a chain of "hard link" file entries to get
    3.22 + 	 * to the actual file */
    3.23 +@@ -312,11 +315,12 @@
    3.24 + 
    3.25 + 		/* XXX: do romfs_checksum here too (with name) */
    3.26 + 
    3.27 ++		spec = be32_to_cpu(ri.spec);
    3.28 + 		nextfh = be32_to_cpu(ri.next);
    3.29 + 		if ((nextfh & ROMFH_TYPE) != ROMFH_HRD)
    3.30 + 			break;
    3.31 + 
    3.32 +-		pos = be32_to_cpu(ri.spec) & ROMFH_MASK;
    3.33 ++		pos = spec & ROMFH_MASK;
    3.34 + 	}
    3.35 + 
    3.36 + 	/* determine the length of the filename */
    3.37 +@@ -352,6 +356,12 @@
    3.38 + 		i->i_fop = &romfs_dir_operations;
    3.39 + 		if (nextfh & ROMFH_EXEC)
    3.40 + 			mode |= S_IXUGO;
    3.41 ++		spec &= 0xf;
    3.42 ++		if (spec != 0) {
    3.43 ++			sb->s_flags |= MS_ROMFS_WITH_DATE;
    3.44 ++			set_nlink(i, spec);
    3.45 ++		}
    3.46 ++		spec = i->i_size;
    3.47 + 		break;
    3.48 + 	case ROMFH_REG:
    3.49 + 		i->i_fop = &romfs_ro_fops;
    3.50 +@@ -367,16 +377,40 @@
    3.51 + 		i->i_data.a_ops = &romfs_aops;
    3.52 + 		mode |= S_IRWXUGO;
    3.53 + 		break;
    3.54 ++	case ROMFH_SCK:
    3.55 ++	case ROMFH_FIF:
    3.56 ++		spec = 0;
    3.57 + 	default:
    3.58 + 		/* depending on MBZ for sock/fifos */
    3.59 +-		nextfh = be32_to_cpu(ri.spec);
    3.60 +-		init_special_inode(i, mode, MKDEV(nextfh >> 16,
    3.61 +-						  nextfh & 0xffff));
    3.62 ++		init_special_inode(i, mode, MKDEV(spec >> 16,
    3.63 ++						  spec & 0xffff));
    3.64 ++		spec = i->i_size;
    3.65 ++		i->i_size = 0;
    3.66 + 		break;
    3.67 + 	}
    3.68 + 
    3.69 + 	i->i_mode = mode;
    3.70 + 
    3.71 ++	if (sb->s_flags & MS_ROMFS_WITH_DATE) {
    3.72 ++
    3.73 ++	        int signed_spec = spec;
    3.74 ++
    3.75 ++		i->i_uid  = signed_spec >> 20;
    3.76 ++		i->i_gid  = (spec >> 12) & 0xFF;
    3.77 ++		if (spec & 0100) 
    3.78 ++			i->i_gid |= ~0xFF;	/* sign extention */
    3.79 ++		i->i_mode &= ~07677;
    3.80 ++		i->i_mode |= spec & 07677;
    3.81 ++
    3.82 ++	/* backward compatibility for blocks and char devices
    3.83 ++	 * when spec is 0, uid = gid = 0 = root and mode is rw- --- ---
    3.84 ++	 * so, these devices have a null size with old romfs code
    3.85 ++	 */
    3.86 ++		i->i_mode ^= 0600;
    3.87 ++
    3.88 ++	        i->i_mtime.tv_sec = i->i_atime.tv_sec = 
    3.89 ++		i->i_ctime.tv_sec = ntohl(ri.checksum);
    3.90 ++	}
    3.91 + 	unlock_new_inode(i);
    3.92 + 	return i;
    3.93 + 
    3.94 +@@ -428,6 +462,7 @@
    3.95 + 		(romfs_maxsize(dentry->d_sb) + ROMBSIZE - 1) >> ROMBSBITS;
    3.96 + 	buf->f_fsid.val[0] = (u32)id;
    3.97 + 	buf->f_fsid.val[1] = (u32)(id >> 32);
    3.98 ++	sb->s_flags &= MS_ROMFS_WITH_DATE;
    3.99 + 	return 0;
   3.100 + }
   3.101 + 
     4.1 --- a/linux/stuff/linux-slitaz.config	Thu Oct 23 11:06:43 2014 +0200
     4.2 +++ b/linux/stuff/linux-slitaz.config	Thu Oct 23 18:05:56 2014 +0200
     4.3 @@ -4571,7 +4571,7 @@
     4.4  # CONFIG_OMFS_FS is not set
     4.5  # CONFIG_HPFS_FS is not set
     4.6  # CONFIG_QNX4FS_FS is not set
     4.7 -# CONFIG_ROMFS_FS is not set
     4.8 +CONFIG_ROMFS_FS=m
     4.9  # CONFIG_PSTORE is not set
    4.10  # CONFIG_SYSV_FS is not set
    4.11  # CONFIG_UFS_FS is not set
     5.1 --- a/linux/stuff/linux-slitaz.config64	Thu Oct 23 11:06:43 2014 +0200
     5.2 +++ b/linux/stuff/linux-slitaz.config64	Thu Oct 23 18:05:56 2014 +0200
     5.3 @@ -4308,7 +4308,7 @@
     5.4  # CONFIG_OMFS_FS is not set
     5.5  # CONFIG_HPFS_FS is not set
     5.6  # CONFIG_QNX4FS_FS is not set
     5.7 -# CONFIG_ROMFS_FS is not set
     5.8 +CONFIG_ROMFS_FS=m
     5.9  # CONFIG_PSTORE is not set
    5.10  # CONFIG_SYSV_FS is not set
    5.11  # CONFIG_UFS_FS is not set
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux64-romfs/receipt	Thu Oct 23 18:05:56 2014 +0200
     6.3 @@ -0,0 +1,45 @@
     6.4 +# SliTaz package receipt.
     6.5 +
     6.6 +PACKAGE="linux64-romfs"
     6.7 +VERSION="3.2.53"
     6.8 +CATEGORY="base-system"
     6.9 +SHORT_DESC="The Linux kernel romfs module."
    6.10 +MAINTAINER="devel@slitaz.org"
    6.11 +LICENSE="GPL2"
    6.12 +DEPENDS="linux64"
    6.13 +WANTED="linux"
    6.14 +PROVIDE="linux-romfs:linux64"
    6.15 +WEB_SITE="http://www.kernel.org/"
    6.16 +CONFIG_FILES="/etc/filesystems"
    6.17 +
    6.18 +# Rules to gen a SliTaz package suitable for Tazpkg.
    6.19 +genpkg_rules()
    6.20 +{
    6.21 +    local path
    6.22 +    install=$install/linux64
    6.23 +    path=lib/modules/$VERSION-slitaz64/kernel
    6.24 +    mkdir -p $fs/$path $fs/etc
    6.25 +    export src
    6.26 +    export install
    6.27 +    $wanted_stuff/list_modules.sh fs/${PACKAGE#*-} | while read module; do
    6.28 +    	dir=$path/$(dirname $module)
    6.29 +    	[ -d $fs/$dir ] || mkdir -p $fs/$dir
    6.30 +        cp -a $install/$path/$module $fs/$dir
    6.31 +    done
    6.32 +    touch $fs/etc/filesystems
    6.33 +}
    6.34 +
    6.35 +# Post install/remove commands for Tazpkg.
    6.36 +post_install()
    6.37 +{
    6.38 +	grep -qs ^${PACKAGE#*-}$ $1/etc/filesystems || \
    6.39 +		echo "${PACKAGE#*-}" >> $1/etc/filesystems
    6.40 +	chroot "$root/" depmod -a $VERSION-slitaz64
    6.41 +}
    6.42 +
    6.43 +post_remove()
    6.44 +{
    6.45 +	sed -i "/^${PACKAGE#*-}\$/d" $1/etc/filesystems
    6.46 +	chroot "$root/" depmod -a $VERSION-slitaz64
    6.47 +}
    6.48 +