yaffs 加入selinux

来源:互联网 发布:网络财经视频直播 编辑:程序博客网 时间:2024/04/30 00:55
www.enck.org/tools/yaffs_xattr.patch

拷贝到内核目录
patch -p1 > yaffs_xattr.patch








froyo : ext4 instead of yaffs2
19 posts by 7 authors in Android Linux Kernel Development
 
andria
Sign in to reply
More message actions
5/9/11
Hi,

I'm trying to moun /data with ext4 instead of yaffs2 on a froyo
emulator.

1- I enabled the support of ext3 and ext4 in the .config and built a
new kernel
2- I launched the emulator with the new zImage to make sure that there
was no error. No error
3- I replaced yaffs2 with ext4 in the init.rc inside froyo source and
built new system.img and ramdisk.img
mount yaffs2 mtd@userdata /data nosuid nodev --> mount ext4
mtd@userdata /data nosuid nodev
4- I launched the emulator and I got errors. Errors occur: services
always die and there is problem with the framework. Here is a sample
of the error message:

D/AudioHardwareInterface(  152): setMode(NORMAL)
I/CameraService(  152): CameraService started: pid=152
I/AudioFlinger(  152): AudioFlinger's thread 0xb3f0 ready to run
E/keystore(  158): chdir: /data/misc/keystore: No such file or
directory
D/AndroidRuntime(  157):
D/AndroidRuntime(  157): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime(  157): CheckJNI is ON
E/dalvikvm(  157): Can't open dex cache '/data/dalvik-cache/
system(at)framework(at)core.jar(at)classes.dex': No such file or
directory
I/dalvikvm(  157): Unable to open or create cache for /system/
framework/core.jar (/data/dalvik-cache/
system(at)framework(at)core.jar(at)classes.dex)
D/dalvikvm(  157): Unable to process classpath element '/system/
framework/core.jar'
E/dalvikvm(  157): Can't open dex cache '/data/dalvik-cache/
system(at)framework(at)ext.jar(at)classes.dex': No such file or
directory
I/dalvikvm(  157): Unable to open or create cache for /system/
framework/ext.jar (/data/dalvik-cache/
system(at)framework(at)ext.jar(at)classes.dex)
D/dalvikvm(  157): Unable to process classpath element '/system/
framework/ext.jar'
E/dalvikvm(  157): Can't open dex cache '/data/dalvik-cache/
system(at)framework(at)framework.jar(at)classes.dex': No such file or
directory
I/dalvikvm(  157): Unable to open or create cache for /system/
framework/framework.jar (/data/dalvik-cache/
system(at)framework(at)framework.jar(at)classes.dex)
D/dalvikvm(  157): Unable to process classpath element '/system/
framework/framework.jar'
E/dalvikvm(  157): Can't open dex cache '/data/dalvik-cache/
system(at)framework(at)android.policy.jar(at)classes.dex': No such
file or directory
I/dalvikvm(  157): Unable to open or create cache for /system/
framework/android.policy.jar (/data/dalvik-cache/
system(at)framework(at)android.policy.jar(at)classes.dex)
D/dalvikvm(  157): Unable to process classpath element '/system/
framework/android.policy.jar'
E/dalvikvm(  157): Can't open dex cache '/data/dalvik-cache/
system(at)framework(at)services.jar(at)classes.dex': No such file or
directory
I/dalvikvm(  157): Unable to open or create cache for /system/
framework/services.jar (/data/dalvik-cache/
system(at)framework(at)services.jar(at)classes.dex)
D/dalvikvm(  157): Unable to process classpath element '/system/
framework/services.jar'
E/dalvikvm(  157): ERROR: no valid entries found in bootclasspath '/
system/framework/core.jar:/system/framework/ext.jar:/system/framework/
framework.jar:/system/framework/android.policy.jar:/system/framework/
services.jar'
W/dalvikvm(  157): JNI_CreateJavaVM failed
E/AndroidRuntime(  157): JNI_CreateJavaVM failed
I/ServiceManager(   27): service 'media.audio_flinger' died
I/ServiceManager(   27): service 'media.player' died
I/ServiceManager(   27): service 'media.camera' died
I/ServiceManager(   27): service 'media.audio_policy' died
I/        (  159): ServiceManager: 0xacd0
D/AudioHardwareInterface(  159): setMode(NORMAL)
I/CameraService(  159): CameraService started: pid=159
I/AudioFlinger(  159): AudioFlinger's thread 0xb3f0 ready to run

Did I miss something to mount succesfully /data with ext4?
Arindam Roy
Sign in to reply
More message actions
5/10/11
Hello Andria,
I am assuming you built the driver as part of kernel aend did not make it a module.
Also, how are ensuring while building the system.img, and ramdisk.img,
proper ext4 filesystems are being built.
Can you share the command line, or make file changes?
Thanks,
Arindam

- show quoted text -
- show quoted text -

--
unsubscribe: android-kerne...@googlegroups.com
website: http://groups.google.com/group/android-kernel

Arindam Roy
Sign in to reply
More message actions
5/10/11
Also, in Froyo, it might not be a good idea to enable ext4.
Because the framework code may not be handling the buffering issue for ext4,
as being done in GB.
http://android-developers.blogspot.com/2010/12/saving-data-safely.html

Thanks,
Arindam
- show quoted text -
andria
Sign in to reply
More message actions
5/10/11
Hi,

Thanks for your reply. To enable the support of ext4 I added the
following lines to .config if they were not written or if the value
was set to n.

CONFIG_EXT4_FS=y
CONFIG_EXT4DEV_COMPAT=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_JBD=y
CONFIG_JBD2=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y

I launch make ARCH=arm CROSS_COMPILE=<froyo_path>/prebuilt/linux-x86/
toolchain/arm-eabi-4.4.0/bin/arm-eabi- to build the new kernel.
At the end I get a new zImage file.

Then I modify the init.rc in the froyo folder.

mount yaffs2 mtd@userdata /data nosuid nodev -> mount ext4
mtd@userdata /data nosuid nodev

I launch make to get new system.img ramdisk.img and userdata.img.

That's all I've done. I also tried to use /dev/block/mtdblock1 instead
of mtd@userdata but it didn't work.

Andria


On 10 mai, 03:26, Arindam Roy <rarin...@gmail.com> wrote:
> Hello Andria,
> I am assuming you built the driver as part of kernel aend did not make it a
> module.
> Also, how are ensuring while building the system.img, and ramdisk.img,
> proper ext4 filesystems are being built.
> Can you share the command line, or make file changes?
> Thanks,
> Arindam
>
>
>
>
>
>
>
- show quoted text -
This message has been deleted.
andria
Sign in to reply
More message actions
5/10/11
One more thing, I use froyo because I don't have a 64 bit computer.
when I try to compile a newer version than froyo, it writes that I
need a 64-bit computer.

Thanks

Andria

On 10 mai, 03:34, Arindam Roy <rarin...@gmail.com> wrote:
> Also, in Froyo, it might not be a good idea to enable ext4.
> Because the framework code may not be handling the buffering issue for ext4,
> as being done in GB.http://android-developers.blogspot.com/2010/12/saving-data-safely.html
>
> <http://android-developers.blogspot.com/2010/12/saving-data-safely.html>
> Thanks,
> Arindam
>
>
>
>
>
>
>
> On Tue, May 10, 2011 at 6:56 AM, Arindam Roy <rarin...@gmail.com> wrote:
> > Hello Andria,
> > I am assuming you built the driver as part of kernel aend did not make it a
> > module.
> > Also, how are ensuring while building the system.img, and ramdisk.img,
> > proper ext4 filesystems are being built.
> > Can you share the command line, or make file changes?
> > Thanks,
> > Arindam
>
- show quoted text -
mpd
Sign in to reply
More message actions
5/11/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
So what improvements t=do you see with using ext4?
- show quoted text -
rari...@gmail.com
Sign in to reply
More message actions
5/11/11
RE: [android-kernel] Re: froyo : ext4 instead of yaffs2
Can you try this out Andria?
http://osdir.com/ml/android-porting/2010-12/msg00272.html#0_undefined,0_

-----Original Message-----
From: andria
Sent:  10/05/2011, 2:47  PM
To: Android Linux Kernel Development
Subject: [android-kernel] Re: froyo : ext4 instead of yaffs2

One more thing, I use froyo because I don't have a 64 bit computer.
when I try to compile a newer version than froyo, it writes that I
need a 64-bit computer.

Thanks

Andria

On 10 mai, 03:34, Arindam Roy <rarin...@gmail.com> wrote:


> Also, in Froyo, it might not be a good idea to enable ext4.
> Because the framework code may not be handling the buffering issue for ext4,
> as being done in GB.http://android-developers.blogspot.com/2010/12/saving-data-safely.html
>
> <http://android-developers.blogspot.com/2010/12/saving-data-safely.html>
> Thanks,
> Arindam
>
>
>
>
>
>
>
- show quoted text -
mpd
Sign in to reply
More message actions
5/11/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
But you don't need anything special on your build computer except the updated tools necessary for 64 bit. Like java 6 etc. My computer I am using for Gingerbread development is an old (7years old) IBM thinkpad.
- show quoted text -
andria
Sign in to reply
More message actions
5/11/11
rarin > The patch command prints that there are malformed patch lines
so I manually did the update. I'm now able to compile gingerbread
thanks to you.
mike > I need ext4 because I'll have to use the extended attributes.

I'm on gingerbread now. I did the same steps to enable the support of
ext4 but I got the same errors. I noticed that I didn't post the dmesg
output. Here is what is logged
<6>yaffs: dev is 32505856 name is "mtdblock0"
<6>yaffs: passed flags ""
<4>yaffs: Attempting MTD mount on 31.0, "mtdblock0"
<4>yaffs_read_super: isCheckpointed 0
<4>save exit: isCheckpointed 0
<4>goldfish_nand_read: invalid read, start 400, len 200, dev_size
4000000, write_size 800
<3>end_request: I/O error, dev mtdblock1, sector 2
<3>EXT4-fs: unable to read superblock
<6>yaffs: dev is 32505858 name is "mtdblock2"
<6>yaffs: passed flags ""
<4>yaffs: Attempting MTD mount on 31.2, "mtdblock2"
<4>yaffs_read_super: isCheckpointed 0

There is an error when the system tries to mount /data. Do you think
that it is due to system.img and/or ramdisk.img? Maybe they are meant
to be used with yaffs2.

Thanks

On 10 mai, 21:30, mike digioia <mpd...@gmail.com> wrote:
> But you don't need anything special on your build computer except the
> updated tools necessary for 64 bit. Like java 6 etc. My computer I am using
> for Gingerbread development is an old (7years old) IBM thinkpad.
>
>
>
>
>
>
>
- show quoted text -
Hedwin
Sign in to reply
More message actions
5/11/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
You can't use an ext filesystem directly one a raw mtd device.
To use a raw mtd device you need to use either yaffs2, jffs2, ubifs
On a MMC device you can use an ext filesystem but you cannot use yaffs2, jffs2 or ubifs
- show quoted text -
Kolja
Sign in to reply
More message actions
5/10/11
Hi andria,

you can't mount ext4 on top of a mtd device. It requires to have a
block device mtd is a flash devices. Becuase ext4 don't know about
wearleaving and other flash specefic things you can not use it
directly on top of a flash device.

cheers Kolja

- show quoted text -
> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel
NLJ
Sign in to reply
More message actions
5/10/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
Hi!

2011/5/10 andria <andr...@gmail.com>

Then I modify the init.rc in the froyo folder.

mount yaffs2 mtd@userdata /data nosuid nodev -> mount ext4
mtd@userdata /data nosuid nodev

I launch make to get new system.img ramdisk.img and userdata.img.

Normally userdata.img contains yaffs2 file system so trying to mount it as ext4 will fail.
You can create ext4 filesystem img using f.ex loop device. Use unyaffs to extract userdata.img.

HTH


--
Name Less, the Jedi
Just a friendly Jedi Knight

Stephen Smalley
Sign in to reply
More message actions
5/12/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
On Wed, 2011-05-11 at 05:53 -0700, andria wrote:
> mike > I need ext4 because I'll have to use the extended attributes.

Just FYI, upstream yaffs2 supports extended attributes; I have it
working with SELinux (with a couple of small changes that I posted to
the yaffs mailing list).

andria
Sign in to reply
More message actions
5/12/11
Thanks evrybody for your responses

Stephen > I'll take a look at it. Is it the same patch that was used
for yaffs2 in TaintDroid? What you were working on seems interesting.
What I intend to do is information flow control. Does the version of
SELinux that you use depends on LSM hooks? Is there a link to your
project or its wiki?

Name Less, the Jedi > What do you mean by f.ex? I downloaded the
unyaffs tool but it doesn't work. But you give me a first clue so I'm
gonna find an unyaffs-like tool.

I thought about an other way: instead of yaffs2 image how about
building an ext4 img directly? It seems like the yaffs2 img are built
by the mkyaffs2image command. So maybe I can replace it with
make_ext4fs.

I'll catch you up if I succeed
- show quoted text -
Arindam Roy
Sign in to reply
More message actions
5/12/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
Hello Andria,
Did you have to shift to 64-bit Ubuntu for this?
Good news at least manual merge worked.
Thanks,
Arindam
- show quoted text -
andria
Sign in to reply
More message actions
5/12/11
Arindam Roy > No I didn't. I manually applied the patch which was
suggested earlier. The build command worked well after that.

On 12 mai, 11:45, Arindam Roy <rarin...@gmail.com> wrote:
> Hello Andria,
> Did you have to shift to 64-bit Ubuntu for this?
> Good news at least manual merge worked.
> Thanks,
> Arindam
>
>
>
>
>
>
>
- show quoted text -
NLJ
Sign in to reply
More message actions
5/12/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
2011/5/12 andria <andr...@gmail.com>


Name Less, the Jedi > What do you mean by f.ex? I downloaded the
unyaffs tool but it doesn't work. But you give me a first clue so I'm
gonna find an unyaffs-like tool.

f.ex == for example. Basically create file of desired size using dd:
  dd if=/dev/zero of=10MBfile bs=10485760 count=1
then associate it with loop device
  losetup -f 10MBfile
make filesystem
  mkfs.ext /dev/loop0 <-- use loop device reported by losetup above

Than you can mount it
  mount /dev/loop0 /mnt/somedir

and put all the files you need/want.

unyaffs takes single argument being name of yaffs img file and unpacks it to current dir



I thought about an other way: instead of yaffs2 image how about
building an ext4 img directly? It seems like the yaffs2 img are built
by the mkyaffs2image command. So maybe I can replace it with
make_ext4fs.

In the long run this would be better.
You can have a look on CyanogenMod sources as I remember seeing mentions on using ext filesystem in prebuilt images.
- show quoted text -
Stephen Smalley
Sign in to reply
More message actions
5/12/11
Re: [android-kernel] Re: froyo : ext4 instead of yaffs2
On Thu, 2011-05-12 at 01:07 -0700, andria wrote:
> Thanks evrybody for your responses
>
> Stephen > I'll take a look at it. Is it the same patch that was used
> for yaffs2 in TaintDroid?

No, upstream yaffs2 added native support for extended attributes last
year. You can just clone the upstream yaffs2 repository and patch it
into your kernel.  If you want new files to automatically have security
attributes set upon creation, you also need the patch I posted to the
yaffs mailing list.

Git repo:
git clone git://www.aleph1.co.uk/yaffs2

Mailing list:
http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs

>  What you were working on seems interesting.
> What I intend to do is information flow control. Does the version of
> SELinux that you use depends on LSM hooks?

Truly enforcing information flow control requires mandatory access
controls in the kernel.
Yes, it depends on LSM hooks (but both LSM and SELinux are part of the
mainline kernel, so it just requires enabling the requisite kernel
configuration options and rebuilding).

>  Is there a link to your
> project or its wiki?

Not yet; it is still in the early stages.