public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>,
	Frank Lenormand <lenormf@gmail.com>
Subject: [PATCH 2/2] meta-isar: Rework boot files copying
Date: Mon, 16 Oct 2017 18:59:01 +0300	[thread overview]
Message-ID: <20171016155901.1724-3-asmirnov@ilbers.de> (raw)
In-Reply-To: <20171016155901.1724-1-asmirnov@ilbers.de>


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 <lenormf@gmail.com>
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 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)
+    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
-- 
2.9.4


  parent reply	other threads:[~2017-10-16 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 15:58 [PATCH 0/2] Correctly determine kernel and initrd versions Alexander Smirnov
2017-10-16 15:59 ` [PATCH 1/2] meta-isar: Drop hardcoded kernel versions Alexander Smirnov
2017-10-16 15:59 ` Alexander Smirnov [this message]
2017-10-16 16:11   ` [PATCH 2/2] meta-isar: Rework boot files copying Henning Schild
2017-10-16 16:30     ` Alexander Smirnov
2017-10-17 16:08       ` Henning Schild
2017-10-17 18:24         ` Alexander Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171016155901.1724-3-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=lenormf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox