public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/2] sdk related updates
@ 2018-09-27 11:10 Maxim Yu. Osipov
  2018-09-27 11:10 ` [PATCH 1/2] sdk: Purge apt cache to make image slimmer Maxim Yu. Osipov
  2018-09-27 11:10 ` [PATCH 2/2] sdk: Check if directories are mounted before unmounting Maxim Yu. Osipov
  0 siblings, 2 replies; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-27 11:10 UTC (permalink / raw)
  To: isar-users

Hi everybody,

This series contains two patches:

* Purge apt cache to make image slimmer

This significantly reduces the size of deployed sdk archive.

* Check if directories are mounted before unmounting

Without this fix unmount fails if directories were not mounted

Kind regards,
Maxim.


Maxim Yu. Osipov (2):
  sdk: Purge apt cache to make image slimmer
  sdk: Check if directories are mounted before unmounting

 meta/classes/image.bbclass | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] sdk: Purge apt cache to make image slimmer
  2018-09-27 11:10 [PATCH 0/2] sdk related updates Maxim Yu. Osipov
@ 2018-09-27 11:10 ` Maxim Yu. Osipov
  2018-09-27 14:11   ` Maxim Yu. Osipov
  2018-09-27 11:10 ` [PATCH 2/2] sdk: Check if directories are mounted before unmounting Maxim Yu. Osipov
  1 sibling, 1 reply; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-27 11:10 UTC (permalink / raw)
  To: isar-users

Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
 meta/classes/image.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3f00806..1db2394 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -104,6 +104,9 @@ do_populate_sdk() {
     # Copy isar-apt with deployed Isar packages
     sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO}  ${SDKCHROOT_DIR}/rootfs/isar-apt
 
+    # Purge apt cache to make image slimmer
+    sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
+
     # Create SDK archive
     sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc
     sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
-- 
2.11.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] sdk: Check if directories are mounted before unmounting
  2018-09-27 11:10 [PATCH 0/2] sdk related updates Maxim Yu. Osipov
  2018-09-27 11:10 ` [PATCH 1/2] sdk: Purge apt cache to make image slimmer Maxim Yu. Osipov
@ 2018-09-27 11:10 ` Maxim Yu. Osipov
  2018-09-27 11:16   ` Jan Kiszka
  1 sibling, 1 reply; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-27 11:10 UTC (permalink / raw)
  To: isar-users

Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
 meta/classes/image.bbclass | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 1db2394..3206877 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -98,6 +98,16 @@ addtask copy_boot_files before do_build after do_rootfs
 do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
 do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
 
+is_mounted() {
+    dir_dev=`stat -c '%D' "$1"`
+    parent_dev=`stat -c '%D' "$1/.."`
+    if [ $dir_dev != $parent_dev ]; then
+        return 0
+    else
+        return 1
+    fi
+}
+
 SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
 
 do_populate_sdk() {
@@ -107,8 +117,10 @@ do_populate_sdk() {
     # Purge apt cache to make image slimmer
     sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
 
+    is_mounted ${SDKCHROOT_DIR}/rootfs/dev && sudo umount ${SDKCHROOT_DIR}/rootfs/dev
+    is_mounted ${SDKCHROOT_DIR}/rootfs/proc && sudo umount ${SDKCHROOT_DIR}/rootfs/proc
+
     # Create SDK archive
-    sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc
     sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
         -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
 
-- 
2.11.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] sdk: Check if directories are mounted before unmounting
  2018-09-27 11:10 ` [PATCH 2/2] sdk: Check if directories are mounted before unmounting Maxim Yu. Osipov
@ 2018-09-27 11:16   ` Jan Kiszka
  2018-09-27 11:20     ` Claudius Heine
  2018-09-27 11:45     ` Maxim Yu. Osipov
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Kiszka @ 2018-09-27 11:16 UTC (permalink / raw)
  To: Maxim Yu. Osipov, isar-users

...because it generates an error otherwise?

On 27.09.18 13:10, Maxim Yu. Osipov wrote:
> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
> ---
>  meta/classes/image.bbclass | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 1db2394..3206877 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -98,6 +98,16 @@ addtask copy_boot_files before do_build after do_rootfs
>  do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
>  do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>  
> +is_mounted() {
> +    dir_dev=`stat -c '%D' "$1"`
> +    parent_dev=`stat -c '%D' "$1/.."`
> +    if [ $dir_dev != $parent_dev ]; then
> +        return 0
> +    else
> +        return 1
> +    fi
> +}
> +
>  SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
>  
>  do_populate_sdk() {
> @@ -107,8 +117,10 @@ do_populate_sdk() {
>      # Purge apt cache to make image slimmer
>      sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
>  
> +    is_mounted ${SDKCHROOT_DIR}/rootfs/dev && sudo umount ${SDKCHROOT_DIR}/rootfs/dev
> +    is_mounted ${SDKCHROOT_DIR}/rootfs/proc && sudo umount ${SDKCHROOT_DIR}/rootfs/proc
> +
>      # Create SDK archive
> -    sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc

Wouldn't it suffice to append "|| true" then?

Jan

>      sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
>          -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
>  
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] sdk: Check if directories are mounted before unmounting
  2018-09-27 11:16   ` Jan Kiszka
@ 2018-09-27 11:20     ` Claudius Heine
  2018-09-27 11:45     ` Maxim Yu. Osipov
  1 sibling, 0 replies; 7+ messages in thread
From: Claudius Heine @ 2018-09-27 11:20 UTC (permalink / raw)
  To: [ext] Jan Kiszka, Maxim Yu. Osipov, isar-users

Hi,

On 9/27/18 1:16 PM, [ext] Jan Kiszka wrote:
> ...because it generates an error otherwise?
> 
> On 27.09.18 13:10, Maxim Yu. Osipov wrote:
>> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
>> ---
>>   meta/classes/image.bbclass | 14 +++++++++++++-
>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index 1db2394..3206877 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -98,6 +98,16 @@ addtask copy_boot_files before do_build after do_rootfs
>>   do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
>>   do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>   
>> +is_mounted() {
>> +    dir_dev=`stat -c '%D' "$1"`
>> +    parent_dev=`stat -c '%D' "$1/.."`
>> +    if [ $dir_dev != $parent_dev ]; then
>> +        return 0
>> +    else
>> +        return 1
>> +    fi
>> +}
>> +
>>   SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
>>   
>>   do_populate_sdk() {
>> @@ -107,8 +117,10 @@ do_populate_sdk() {
>>       # Purge apt cache to make image slimmer
>>       sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
>>   
>> +    is_mounted ${SDKCHROOT_DIR}/rootfs/dev && sudo umount ${SDKCHROOT_DIR}/rootfs/dev
>> +    is_mounted ${SDKCHROOT_DIR}/rootfs/proc && sudo umount ${SDKCHROOT_DIR}/rootfs/proc
>> +
>>       # Create SDK archive
>> -    sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc
> 
> Wouldn't it suffice to append "|| true" then?

There is also `mountpoint(1)` from util-linux.

Claudius

> 
> Jan
> 
>>       sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
>>           -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
>>   
>>
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] sdk: Check if directories are mounted before unmounting
  2018-09-27 11:16   ` Jan Kiszka
  2018-09-27 11:20     ` Claudius Heine
@ 2018-09-27 11:45     ` Maxim Yu. Osipov
  1 sibling, 0 replies; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-27 11:45 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On 9/27/18 2:16 PM, Jan Kiszka wrote:
> ...because it generates an error otherwise?
> 
> On 27.09.18 13:10, Maxim Yu. Osipov wrote:
>> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
>> ---
>>   meta/classes/image.bbclass | 14 +++++++++++++-
>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index 1db2394..3206877 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -98,6 +98,16 @@ addtask copy_boot_files before do_build after do_rootfs
>>   do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
>>   do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>   
>> +is_mounted() {
>> +    dir_dev=`stat -c '%D' "$1"`
>> +    parent_dev=`stat -c '%D' "$1/.."`
>> +    if [ $dir_dev != $parent_dev ]; then
>> +        return 0
>> +    else
>> +        return 1
>> +    fi
>> +}
>> +
>>   SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
>>   
>>   do_populate_sdk() {
>> @@ -107,8 +117,10 @@ do_populate_sdk() {
>>       # Purge apt cache to make image slimmer
>>       sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
>>   
>> +    is_mounted ${SDKCHROOT_DIR}/rootfs/dev && sudo umount ${SDKCHROOT_DIR}/rootfs/dev
>> +    is_mounted ${SDKCHROOT_DIR}/rootfs/proc && sudo umount ${SDKCHROOT_DIR}/rootfs/proc
>> +
>>       # Create SDK archive
>> -    sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc
> 
> Wouldn't it suffice to append "|| true" then?

Yep, that would be more short...

Thanks,
Maxim.


> 
> Jan
> 
>>       sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
>>           -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
>>   
>>
> 


-- 
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] sdk: Purge apt cache to make image slimmer
  2018-09-27 11:10 ` [PATCH 1/2] sdk: Purge apt cache to make image slimmer Maxim Yu. Osipov
@ 2018-09-27 14:11   ` Maxim Yu. Osipov
  0 siblings, 0 replies; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-27 14:11 UTC (permalink / raw)
  To: isar-users

Applied to the 'next'.

On 9/27/18 2:10 PM, Maxim Yu. Osipov wrote:
> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
> ---
>   meta/classes/image.bbclass | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 3f00806..1db2394 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -104,6 +104,9 @@ do_populate_sdk() {
>       # Copy isar-apt with deployed Isar packages
>       sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO}  ${SDKCHROOT_DIR}/rootfs/isar-apt
>   
> +    # Purge apt cache to make image slimmer
> +    sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
> +
>       # Create SDK archive
>       sudo umount ${SDKCHROOT_DIR}/rootfs/dev ${SDKCHROOT_DIR}/rootfs/proc
>       sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
> 


-- 
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-27 14:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 11:10 [PATCH 0/2] sdk related updates Maxim Yu. Osipov
2018-09-27 11:10 ` [PATCH 1/2] sdk: Purge apt cache to make image slimmer Maxim Yu. Osipov
2018-09-27 14:11   ` Maxim Yu. Osipov
2018-09-27 11:10 ` [PATCH 2/2] sdk: Check if directories are mounted before unmounting Maxim Yu. Osipov
2018-09-27 11:16   ` Jan Kiszka
2018-09-27 11:20     ` Claudius Heine
2018-09-27 11:45     ` Maxim Yu. Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox