From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6693487099162656768 X-Received: by 2002:a5d:6243:: with SMTP id m3mr6142717wrv.41.1558618575891; Thu, 23 May 2019 06:36:15 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6000:1204:: with SMTP id e4ls447156wrx.5.gmail; Thu, 23 May 2019 06:36:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqafaMJ7uGAFdGp2pWPk3QefkDaipTOp1eP/keVhovBcR6u7HszHe+OpqRFg+niStysCg/ X-Received: by 2002:adf:dc09:: with SMTP id t9mr31359404wri.69.1558618575415; Thu, 23 May 2019 06:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558618575; cv=none; d=google.com; s=arc-20160816; b=my7mXjG/0f1zQgDOUUcvnkuxK596AM6SzcGGlAl+tLxn2+2EE2fsqa4+eF0JN7glmF nP5mwV1TUD2MNJZKnreN9QjQYfCvuweOxcdXYPzeGwZG2oniwmn7qrxI0Qkr3mlbOafn 4Ddlo9f+I8BpRbG+Fm5g9TrxtjFS90soFcdCaU/nr2CgaCPhm0luMA2ma+H5bmil4Eo6 zqeyeoz6/dJ1qcKedfrypmMuMznw7kd3s7RyXu0WUu9bQ6tIpUFXeloF4GME5NWOlHbd mUevpOzwPCgpMnltZqeEdRiisn8AL3x0JXxX+TxscCrcASH53955X0sHWc19JiH6YSXu bEeg== 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; bh=U3z9Nz7Qa3yhj3ezofcTDfjU0mFq0PqiPnfJrUIreR4=; b=bILERIGwjLZY/jUpQbXVaxqFtfzjZtoWjMdo3zjPADsblEActUblideyqnaeeG+liV o7ad1qqgwBMZViPA0xTkt1h9QhhGmUlCfSHun4xX82i82SG8XuVPcIOEWS1MW32nhJJm b/nmITJ4TkqRjERhrmGd4q9nrWRkBPmnzzJqT7rO5QUP59r7x107vrgzNxElkHpzrw1Q fgqHI/1MpsaGCbAG5pbT3EaI+sF6fzmS8C417q+bcbx/3CEeej+KrtlR6gJYbjCjqKfs oPW7Pu5ACuc/+InL7X541av183rgPjycohJrkxXtsn0AU6plMkUOpY31fLciILGwPPlZ F2Kg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id h3si161098wrw.4.2019.05.23.06.36.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 06:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x4NDaEp4003429 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 May 2019 15:36:14 +0200 Received: from [139.25.69.232] (linux-ses-ext02.ppmd.siemens.net [139.25.69.232]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x4NDaEJ2026540; Thu, 23 May 2019 15:36:14 +0200 Subject: Re: [PATCH] image.bbclass: remove 'get_image_name' function To: Henning Schild Cc: isar-users@googlegroups.com, Claudius Heine References: <20190521142818.25505-1-claudius.heine.ext@siemens.com> <20190523144654.70b5450d@md1za8fc.ad001.siemens.net> From: Claudius Heine Message-ID: <82278feb-f3ab-a859-1c0e-3d594810e1cb@siemens.com> Date: Thu, 23 May 2019 15:36:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190523144654.70b5450d@md1za8fc.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: AIc3J7DrNUU9 Hi Henning, On 23/05/2019 14.46, Henning Schild wrote: > Am Tue, 21 May 2019 16:28:18 +0200 > schrieb "[ext] claudius.heine.ext@siemens.com" > : > >> From: Claudius Heine >> >> This function is only used in 'do_copy_boot_files' where a simple >> shell function fits better. >> >> Signed-off-by: Claudius Heine >> --- >> meta/classes/image.bbclass | 33 ++++++--------------------------- >> 1 file changed, 6 insertions(+), 27 deletions(-) >> >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 3eb261f..45ed8ba 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -64,29 +64,6 @@ inherit image-postproc-extension >> # Extra space for rootfs in MB >> ROOTFS_EXTRA ?= "64" >> >> -def get_image_name(d, name_link): >> - S = d.getVar("IMAGE_ROOTFS", True) >> - path_link = os.path.join(S, name_link) >> - >> - # If path_link does not exist, it might be a symlink >> - # in the target rootfs. This block attempts to resolve >> - # it relative to the rootfs location. >> - if not os.path.exists(path_link): >> - path_link = os.path.join( >> - S, >> - os.path.relpath( >> - os.path.realpath(path_link), >> - "/", >> - ), >> - ) >> - >> - if os.path.exists(path_link): >> - base = os.path.basename(os.path.realpath(path_link)) >> - full = d.getVar("IMAGE_FULLNAME", True) + "." + base >> - return [base, full] >> - >> - return ["", ""] >> - >> def get_rootfs_size(d): >> import subprocess >> rootfs_extra = int(d.getVar("ROOTFS_EXTRA", True)) >> @@ -149,12 +126,14 @@ addtask rootfs_install before do_build after >> do_unpack >> do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}" >> do_copy_boot_files() { >> - if [ -n "${KERNEL_IMAGE}" ]; then >> - cp -f ${IMAGE_ROOTFS}/boot/${@get_image_name(d, >> 'vmlinuz')[0]} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE} >> + kernel="$(realpath -q '${IMAGE_ROOTFS}/vmlinuz')" > > Will this work if ${IMAGE_ROOTFS}/vmlinuz is a symlink to > "/boot/vmlinuz-foo-bar"? Do you have a different solution in mind? Those links are created by linux-update-symlinks from the linux-base package and I think that using absolute paths there will probably cause many different issues, so I don't think they did that accidentally. I tried around for a while to cover all different cases, but I stopped because don't think that makes sense here until we find a case where those links are absolute. > The funny thing with the kernel and the initrd is that we should > probably stop deploying them anyways. As far as i know there are > probably 2 users of them. The first is the qemu test script, which > should be fixed to use IMAGE_RFS/vmlinuz and deal with possible > symlinks. > The second one is the legacy bios wic. This one is also just broken > because it creates a boot partition with copies of kernel and initrd, > that debian does not even know about. So you will also never be able to > update the kernel with apt ... If any other imager needs the deployed > KERNEL and INITRD ... that other imager probably has the same issue. If a post-install step removes the kernel+initrd from the /boot, then the fitimage class still needs to find the kernel+dtb and possible the initrd. This would be the case if you have a project that should be deployed on a small nand. Updating via apt is not important there. > So in the long run we should just drop that and fix those imagers to > turn the real /boot into the boot partition and fix up /etc/fstab. You don't have a boot partition on some devices. regards, Claudius > > Henning > >> + if [ -n "$kernel" ]; then >> + cp -f "$kernel" '${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE}' >> fi >> >> - if [ -n "${INITRD_IMAGE}" ]; then >> - sudo cp -f ${IMAGE_ROOTFS}/boot/${@get_image_name(d, >> 'initrd.img')[0]} ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE} >> + initrd="$(realpath -q '${IMAGE_ROOTFS}/initrd.img')" >> + if [ -n "$initrd" ]; then >> + cp -f "$initrd" '${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}' >> fi >> >> # Check DTB_FILE via inline python to handle unset case: > -- 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