[poky] [PATCH 0/3][RFC] Poky disk space size optimization

Xu, Dongxiao dongxiao.xu at intel.com
Tue Dec 7 22:19:12 PST 2010


Thanks for your review.
Some comments from me, see inline.

Tian, Kevin wrote:
>> From: Saul Wold
>> Sent: Tuesday, December 07, 2010 10:47 AM
>> 
>> On 12/06/2010 04:50 PM, Dongxiao Xu wrote:
>>> This RFC aims to reduce the poky disk space size.
>>> 
>>> The optimization point is the duplicated file copies in WORKDIR and
>>> sysroot directories. When installing, files will be copied from
>>> source code package into the image folder; Then some files will be
>>> copied from image folder to sysroot-destdir, and some other files
>>> will be copied from image folder to package folder. While doing
>>> package split, some files will be copied from package folder to
>>> packages-split folder, etc. 
>>> 
>> There are a couple of concerns with this method, which may lead to
>> problems, first is that using links and modifying permissions, it's
>> possible that depending on the usage the permissions might be set
>> differently.  This will could lead to a second problem: psuedo. It's
>> unclear at this point how psuedo will handle this.

For normal files, the file name is a hard link to the disk storage. Therefore if we use hard link instead of copy, what we present to pseudo doesn't change.

For file permissions, could you give some example on permission change?
Per my understanding, file permissions are determined while do_install, which is beyond the following process. (package.bbclass will also do some file permission operations, but it is done before the hard link.)

hard link "image-->sysroot-destdir"
hard link "package-->packages-split"
hard link "sysroot-destdir-->sysroots".

After these hardlink is done, I am not aware there is file permission change. (Postinst is an exception, which is run in target system and not related with our build process).

>> 
>> I am sure you have been doing testing, just not sure of corner cases.
>> 
>> I know we accepted the first change for the package split link to the
>> deploy area, that one made sense as it was package level, this is
>> file level and may have hidden problems.

Actually this is also file level link. But it doesn't matter since package-->packages-split doesn't change any file.

> 
> I also agree with Saul here. There do have some difference among
> those directories for their own purpose, which finally result in some
> difference. For example, there're different tweaks on libtool and
> pkgconfig files between sysroot and packaging. That's why 'image' is
> copied to package and then sysroot-destdir, and then do necessary
> tweaks independently. Here if you want to hard link image to
> sysroot-destdir, you need make sure it done after the copy from image
> to package. Or else you'll end up to have problem there.       

For those ".la" files,
In "image-->sysroot-destdir" process, dependency_libs will be modified in image folder before hard link.
In "package-->packages-split", dependency_libs are the same and it is modified after "image-->package" copies is done.

No matter which runs first, they will modify dependency_libs for their own copy, since files within "sysroot-destdir" and "package" are NOT hardlink. They maintain separate copies.

I think there should be no problem.

Anyway we hope Richard could give us a comment in case we missed something.

Thanks,
Dongxiao

> 
> But if you can make sure that given a copy path you're modifying, the
> source and the destination are exactly same, and no other path refers
> to the source directory, perhaps it's fine to do hard link.  
> 
> Thanks
> Kevin
> 
>> 
>> I am sure that Richard will correct me and add his comments as he
>> recovers from his travels. 
>> 
>> Sau!
>> 
>>> The thought is to use hard link to replace the direct copy.
>>> The three commits do the work of:
>>> 
>>> a) package.bbclass: hard link "image-->sysroot-destdir"
>>> b) sstate.bbclass:  hard link "package-->packages-split"
>>> c) staging.bbclass: hard link "sysroot-destdir-->sysroots".
>>> 
>>> After testing with minimal/sato/sdk build, this approach could save
>>> about 20% disk space. (minimal: 23G ->  19G, sato: 44G ->  35G,
>>> sdk: 54G ->  44G). 
>>> 
>>> Pull URL: git://git.pokylinux.org/poky-contrib.git
>>>    Branch: dxu4/perf
>>>    Browse:
>>> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/perf
>>> 
>>> Thanks,
>>>      Dongxiao Xu<dongxiao.xu at intel.com>
>>> ---
>>> 
>>> 
>>> Dongxiao Xu (3):
>>>    package.bbclass: Use hard link for package split instead of copy
>>>    sstate.bbclass: Use hard link when staging files into sysroots
>>>    staging.bbclass: use hardlink when staging files to
>>> sysroot-destdir 
>>> 
>>>   meta/classes/package.bbclass |    8 +++++---
>>>   meta/classes/sstate.bbclass  |    2 +-
>>>   meta/classes/staging.bbclass |   27 ++++++++++++++++++++++++++-
>>>   meta/lib/oe/path.py          |   28 ++++++++++++++++++++++++++++
>>>   4 files changed, 60 insertions(+), 5 deletions(-)
>>> 
>>> _______________________________________________
>>> poky mailing list
>>> poky at yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/poky
>>> 
>> 
>> _______________________________________________
>> poky mailing list
>> poky at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/poky




More information about the poky mailing list