From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6477538949418975232 X-Received: by 10.28.92.18 with SMTP id q18mr539632wmb.15.1508264672305; Tue, 17 Oct 2017 11:24:32 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.159.4 with SMTP id i4ls448969wme.3.gmail; Tue, 17 Oct 2017 11:24:31 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDDDO9tt2ajFpuYJ1J6HtdGPU8q5oogpBdRs+QjQe0ygcxk0CMZcgPU32ANVliD4xe+V1HK X-Received: by 10.223.172.72 with SMTP id v66mr1193415wrc.16.1508264671913; Tue, 17 Oct 2017 11:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508264671; cv=none; d=google.com; s=arc-20160816; b=gVys1pvfxRlj0kmE9FkF4qMzlGFyERgmzgs4GvRwi6hM+t5U12N2ePyoQIgYNAF4iS kq11UGT6q2Pazdm8OKxJT293BTBunzVsDfd3V9GHQ58AH7EdZ2hrSBBZd2KF33uj8B77 ULUHpPF6OwMmZCcZAMhLtHXF9KAQR1wWzmfQtmeLcsuzj/M4efge8F5Uxr0CW/YRUNGb 0EXGMt1a/Jx3GYrl3NjGZhTFjHLJctLQG36/2cpO8PiNRyc+iZA8j6z9ZxjR/RLs26xr Psmtq5zsTrCuiwFvG1tCoUiy9fic+/XwtHCxPrEK+jQSvGQtuaG0Ra3zhqrSah7QNO/x kuww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=hzRbG0w5LMWdmsx/7v13OBK/sS2pV+MuebQS0rOIXWg=; b=Ani3McPA9L5+PGI+++bFQLNyNZXsPn5DZ8YWYdA/ZC9oevl3T4Zpbnuh8wH50S6fKl qWOjlOBrWIxTgND94UoLCeTiKWMDR0GPMM/zr1xWuW1jsl7JfmIXA3EJ3eqznD1l8ocr S+hUk0B6DNNrewQIhGgtcJlj/TeTzCm/N+1sayyUV3jwF03ERIEgvGyJRnm2PVlkiRbZ 7H4WcpyyKaRL23wtQFxt9L5IprtO0PZqQjHQda5s0RiIWNaVQbVEZ6sFwXLopedoUQa5 Mtn724B90BKg3RI47wR4aSgSoJAlBm2WmuzhJXMy/YAWj4O3jFcwJJvgsYhHy9WelBSn Prwg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id p70si481715wma.1.2017.10.17.11.24.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 11:24:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id v9HIOSKw012746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 17 Oct 2017 20:24:30 +0200 Subject: Re: [PATCH 2/2] meta-isar: Rework boot files copying To: Henning Schild Cc: isar-users@googlegroups.com References: <20171016155901.1724-1-asmirnov@ilbers.de> <20171016155901.1724-3-asmirnov@ilbers.de> <20171016181158.693048ca@md1em3qc> <6dbeba83-84cc-c475-0120-ab38b76a9d03@ilbers.de> <20171017180804.5a265c9e@md1em3qc> From: Alexander Smirnov Message-ID: <8fc6ce20-83c2-8142-289e-26e4de0c89ca@ilbers.de> Date: Tue, 17 Oct 2017 21:24:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20171017180804.5a265c9e@md1em3qc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: 9HXy6u51mguW On 10/17/2017 07:08 PM, Henning Schild wrote: > On Mon, 16 Oct 2017 19:30:21 +0300 > Alexander Smirnov wrote: > >> On 10/16/2017 07:11 PM, Henning Schild wrote: >>> On Mon, 16 Oct 2017 18:59:01 +0300 >>> Alexander Smirnov wrote: >>> >>>> Currently there are two variables that contains hardcoded filenames >>>> with versions for kernel and initrd images. Isar uses them to copy >>>> these files to deploy directory. Moreover this is performed in ext4 >>>> class, what is logically wrong. >>>> >>>> This patch implements a new way which doesn't rely on hardcoded >>>> versioned filenames. Also it drops this copying from ext4 class. >>>> >>>> Signed-off-by: Frank Lenormand >>>> Signed-off-by: Alexander Smirnov >>>> --- >>>> meta-isar/conf/multiconfig/qemuamd64-jessie.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemuarm-jessie.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemuarm-stretch.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemuarm-wheezy.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemui386-jessie.conf | 3 --- >>>> meta-isar/conf/multiconfig/qemui386-stretch.conf | 3 --- >>>> meta-isar/conf/multiconfig/rpi-jessie.conf | 3 --- >>>> meta/classes/ext4-img.bbclass | 8 -------- >>>> meta/classes/image.bbclass | 23 >>>> ++++++++++++++++++++--- 10 files changed, 20 insertions(+), 35 >>>> deletions(-) >>>> >>>> diff --git a/meta-isar/conf/multiconfig/qemuamd64-jessie.conf >>>> b/meta-isar/conf/multiconfig/qemuamd64-jessie.conf index >>>> d9473f3..51d39b6 100644 --- >>>> a/meta-isar/conf/multiconfig/qemuamd64-jessie.conf +++ >>>> b/meta-isar/conf/multiconfig/qemuamd64-jessie.conf @@ -8,9 +8,6 @@ >>>> DISTRO_ARCH ?= "amd64" >>>> IMAGE_PREINSTALL += "linux-image-amd64" >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-3.16.0-4-amd64" >>>> -INITRD_IMAGE ?= "initrd.img-3.16.0-4-amd64" >>>> - >>>> ROOTFS_DEV ?= "sda" >>>> >>>> QEMU_ARCH ?= "x86_64" >>>> diff --git a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf >>>> b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf index >>>> 5ac25d9..c59876a 100644 --- >>>> a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf +++ >>>> b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf @@ -11,9 +11,6 >>>> @@ IMAGE_PREINSTALL += " \ linux-image-amd64 \ >>>> " >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-4.9.0-4-amd64" >>>> -INITRD_IMAGE ?= "initrd.img-4.9.0-4-amd64" >>>> - >>>> ROOTFS_DEV ?= "sda" >>>> >>>> QEMU_ARCH ?= "x86_64" >>>> diff --git a/meta-isar/conf/multiconfig/qemuarm-jessie.conf >>>> b/meta-isar/conf/multiconfig/qemuarm-jessie.conf index >>>> 3dd33f2..ed84c6c 100644 --- >>>> a/meta-isar/conf/multiconfig/qemuarm-jessie.conf +++ >>>> b/meta-isar/conf/multiconfig/qemuarm-jessie.conf @@ -15,9 +15,6 @@ >>>> DISTRO_ARCH ?= "armhf" >>>> IMAGE_PREINSTALL += "linux-image-armmp" >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-3.16.0-4-armmp" >>>> -INITRD_IMAGE ?= "initrd.img-3.16.0-4-armmp" >>>> - >>>> ROOTFS_DEV ?= "vda" >>>> >>>> QEMU_ARCH ?= "arm" >>>> diff --git a/meta-isar/conf/multiconfig/qemuarm-stretch.conf >>>> b/meta-isar/conf/multiconfig/qemuarm-stretch.conf index >>>> f3636f6..1cce97a 100644 --- >>>> a/meta-isar/conf/multiconfig/qemuarm-stretch.conf +++ >>>> b/meta-isar/conf/multiconfig/qemuarm-stretch.conf @@ -11,9 +11,6 @@ >>>> IMAGE_PREINSTALL += " \ linux-image-armmp \ >>>> " >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-4.9.0-4-armmp" >>>> -INITRD_IMAGE ?= "initrd.img-4.9.0-4-armmp" >>>> - >>>> ROOTFS_DEV ?= "vda" >>>> >>>> QEMU_ARCH ?= "arm" >>>> diff --git a/meta-isar/conf/multiconfig/qemuarm-wheezy.conf >>>> b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf index >>>> 3a23692..38ea191 100644 --- >>>> a/meta-isar/conf/multiconfig/qemuarm-wheezy.conf +++ >>>> b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf @@ -15,9 +15,6 @@ >>>> DISTRO_ARCH ?= "armhf" >>>> IMAGE_PREINSTALL += "linux-image-vexpress" >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-3.2.0-4-vexpress" >>>> -INITRD_IMAGE ?= "initrd.img-3.2.0-4-vexpress" >>>> - >>>> ROOTFS_DEV ?= "mmcblk0" >>>> >>>> QEMU_ARCH ?= "arm" >>>> diff --git a/meta-isar/conf/multiconfig/qemui386-jessie.conf >>>> b/meta-isar/conf/multiconfig/qemui386-jessie.conf index >>>> 55cb172..d589661 100644 --- >>>> a/meta-isar/conf/multiconfig/qemui386-jessie.conf +++ >>>> b/meta-isar/conf/multiconfig/qemui386-jessie.conf @@ -8,9 +8,6 @@ >>>> DISTRO_ARCH ?= "i386" >>>> IMAGE_PREINSTALL += "linux-image-686-pae" >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-3.16.0-4-686-pae" >>>> -INITRD_IMAGE ?= "initrd.img-3.16.0-4-686-pae" >>>> - >>>> ROOTFS_DEV ?= "sda" >>>> >>>> QEMU_ARCH ?= "i386" >>>> diff --git a/meta-isar/conf/multiconfig/qemui386-stretch.conf >>>> b/meta-isar/conf/multiconfig/qemui386-stretch.conf index >>>> c0285b4..40239e4 100644 --- >>>> a/meta-isar/conf/multiconfig/qemui386-stretch.conf +++ >>>> b/meta-isar/conf/multiconfig/qemui386-stretch.conf @@ -11,9 +11,6 >>>> @@ IMAGE_PREINSTALL += " \ linux-image-686-pae \ >>>> " >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-4.9.0-4-686-pae" >>>> -INITRD_IMAGE ?= "initrd.img-4.9.0-4-686-pae" >>>> - >>>> ROOTFS_DEV ?= "sda" >>>> >>>> QEMU_ARCH ?= "i386" >>>> diff --git a/meta-isar/conf/multiconfig/rpi-jessie.conf >>>> b/meta-isar/conf/multiconfig/rpi-jessie.conf index 82b38d2..d1dd9d9 >>>> 100644 --- a/meta-isar/conf/multiconfig/rpi-jessie.conf >>>> +++ b/meta-isar/conf/multiconfig/rpi-jessie.conf >>>> @@ -31,7 +31,4 @@ IMAGE_PREINSTALL += " \ >>>> vim \ >>>> " >>>> >>>> -KERNEL_IMAGE ?= "vmlinuz-4.9.0-3-rpi" >>>> -INITRD_IMAGE ?= "initrd.img-4.9.0-3-rpi" >>>> - >>>> ROOTFS_DEV ?= "mmcblk0p2" >>>> diff --git a/meta/classes/ext4-img.bbclass >>>> b/meta/classes/ext4-img.bbclass index 9fa9aa5..277f3f3 100644 >>>> --- a/meta/classes/ext4-img.bbclass >>>> +++ b/meta/classes/ext4-img.bbclass >>>> @@ -24,14 +24,6 @@ do_ext4_image() { >>>> sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt >>>> sudo umount ${WORKDIR}/mnt >>>> rm -r ${WORKDIR}/mnt >>>> - >>>> - if [ -n "${KERNEL_IMAGE}" ]; then >>>> - cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE} >>>> ${DEPLOY_DIR_IMAGE} >>>> - fi >>>> - >>>> - if [ -n "${INITRD_IMAGE}" ]; then >>>> - cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE} >>>> ${DEPLOY_DIR_IMAGE} >>>> - fi >>>> } >>>> >>>> addtask ext4_image before do_build after do_rootfs >>>> diff --git a/meta/classes/image.bbclass >>>> b/meta/classes/image.bbclass index 9ef8bee..5d917622 100644 >>>> --- a/meta/classes/image.bbclass >>>> +++ b/meta/classes/image.bbclass >>>> @@ -1,9 +1,6 @@ >>>> # This software is a part of ISAR. >>>> # Copyright (C) 2015-2017 ilbers GmbH >>>> >>>> -KERNEL_IMAGE ?= "" >>>> -INITRD_IMAGE ?= "" >>>> - >>>> IMAGE_INSTALL ?= "" >>>> IMAGE_TYPE ?= "ext4-img" >>>> IMAGE_ROOTFS = "${WORKDIR}/rootfs" >>>> @@ -76,3 +73,23 @@ do_populate() { >>>> >>>> addtask populate before do_build >>>> do_populate[deptask] = "do_deploy_deb" >>>> + >>>> +do_copy_boot_files() { >>>> + if [ -z "${KERNEL_IMAGE}" ]; then >>>> + KERNEL_IMAGE=$(readlink ${IMAGE_ROOTFS}/vmlinuz) >>> >>> readlink -e in case it is no symlink or a chain of links, debian >>> packages do not do that but custom kernels could behave differently >>> >> >> For custom kernels, if you don't follow debian style, you could >> define KERNEL_IMAGE and INITRD_IMAGE in your local config (like it >> was before). This function doesn't touch these variables if they are >> already defined. So I assume that if they aren't defined - the pure >> debian is used. >> >> I'd suggest to rely on debian style for default cases, this will help >> to avoid defining of custom policies without real use-cases. If >> eventually we will find out, that for some specific case the default >> policy doesn't work, then we could define new custom one. > > Sure, as long as you are absolutely sure that these files will always > be symlinks and there will never be a symlink chain. I would not rely > on that and just add the "-e" it does not do any harm. > Tried to test with '-e' parameter and got the following for Raspbian: asmirnov@zbook:~/Work/isar/isar/build$ readlink -e /home/asmirnov/Work/isar/isar/build/tmp/work/debian-jessie-armhf/isar-image-base/rootfs/initrd.img asmirnov@zbook:~/Work/isar/isar/build$ readlink /home/asmirnov/Work/isar/isar/build/tmp/work/debian-jessie-armhf/isar-image-base/rootfs/initrd.img /boot/initrd.img-3.16.0-4-armm Alex >>> >>>> + fi >>>> + >>>> + if [ -n "${KERNEL_IMAGE}" ]; then >>>> + cp ${IMAGE_ROOTFS}/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE} >>>> + fi >>>> + >>>> + if [ -z "${INITRD_IMAGE}" ]; then >>>> + INITRD_IMAGE=$(readlink ${IMAGE_ROOTFS}/initrd.img) >>>> + fi >>>> + >>>> + if [ -n "${INITRD_IMAGE}" ]; then >>>> + cp ${IMAGE_ROOTFS}/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE} >>>> + fi >>>> +} >>>> + >>>> +addtask copy_boot_files before do_build after do_rootfs >>> >> > -- With best regards, Alexander Smirnov ilbers GmbH Baierbrunner Str. 28c D-81379 Munich +49 (89) 122 67 24-0 http://ilbers.de/ Commercial register Munich, HRB 214197 General manager: Baurzhan Ismagulov