Skip to contentSkip to conversation

classes/kernel: Use a copied image for kernel*.rpm if fs don't support symlinks

PATCH Superseded Xu, Yanfei 3 participants 5 messages Jun 18, 2020 1 message not in the archive

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Xu, Yanfei

author
#0 lore raw

PATCH v2 1/1 classes/kernel: Use a copied image for kernel*.rpm if fs don't support symlinks

From: Yanfei Xu <[email protected]>

Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copied iamge for these filesystems instead of symlink.

---
 meta/classes/kernel.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +9 -1
index 41101a64a0..749d1a0f29 100644
@@ -94,6 +94,14 @@ python __anonymous () {
         d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
         d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
         d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+        d.setVar('pkg_postinst_ontarget_%s-image-%s' % (kname,typelower), """
+set +e
+ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+    echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+fi
+set -e
+""" % (type, type, type))
 
     image = d.getVar('INITRAMFS_IMAGE')
     # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
@@ -386,7 +394,7 @@ kernel_do_install() {
 	for imageType in ${KERNEL_IMAGETYPES} ; do
 		install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
 		if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
-			ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
+			install -m 0644 ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
 		fi
 	done
 	install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
Signature · 1 line
2.18.2
#1 lore raw
Quoted 32 lines · Yanfei

From: Yanfei Xu <[email protected]>

Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copied iamge for these filesystems instead of symlink.

---
 meta/classes/kernel.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +8 -0
index 41101a64a0..749d1a0f29 100644
@@ -94,6 +94,14 @@ python __anonymous () {
         d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
         d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
         d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+        d.setVar('pkg_postinst_ontarget_%s-image-%s' % (kname,typelower), """
+set +e
+ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+    echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+fi
+set -e
+""" % (type, type, type))
 
     image = d.getVar('INITRAMFS_IMAGE')
     # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,

meta/classes/kernel.bbclass kernel_do_install() { · line 400

Quoted 8 lines
meta/classes/kernel.bbclass +1 -1
@@ -386,7 +394,7 @@ kernel_do_install() {
 	for imageType in ${KERNEL_IMAGETYPES} ; do
 		install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
 		if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
-			ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
+			install -m 0644 ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
 		fi
 	done
 	install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}

I am a bit concerned about this since whilst it solves one problem, doesn't having two copies of the same file around significantly increase the size of the packages and the update payloads updating such systems would need? Are these two copies of the file in the same package or not?

Perhaps the symlink creation should fall back to a copy on device rather than having the copy at build time (as I understand it)?

Cheers,

Richard

author
#2 lore raw
Quoted 48 lines · Richard Purdie
Quoted 32 lines · Yanfei

From: Yanfei Xu <[email protected]>

Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copied iamge for these filesystems instead of symlink.

---
  meta/classes/kernel.bbclass | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +8 -0
index 41101a64a0..749d1a0f29 100644
@@ -94,6 +94,14 @@ python __anonymous () {
          d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
          d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
          d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+        d.setVar('pkg_postinst_ontarget_%s-image-%s' % (kname,typelower), """
+set +e
+ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+    echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+fi
+set -e
+""" % (type, type, type))
 
      image = d.getVar('INITRAMFS_IMAGE')
      # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,

meta/classes/kernel.bbclass kernel_do_install() { · line 400

Quoted 8 lines
meta/classes/kernel.bbclass +1 -1
@@ -386,7 +394,7 @@ kernel_do_install() {
  	for imageType in ${KERNEL_IMAGETYPES} ; do
  		install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
  		if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
-			ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
+			install -m 0644 ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
  		fi
  	done
  	install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}

I am a bit concerned about this since whilst it solves one problem, doesn't having two copies of the same file around significantly increase the size of the packages and the update payloads updating such systems would need? Are these two copies of the file in the same package or not?

Quoted 3 lines

Perhaps the symlink creation should fall back to a copy on device rather than having the copy at build time (as I understand it)?

I had a wrong understanding about the no-versioned Image in /boot partation from wic. And I just verified that the no-versioned Image in /boot partation seems doesn't from kernel image package. So you are right, we don't need to have the other no-versioned image in packages.

I'll change the logic to having the copy at build time in v3.

Cheers,

Yanfei

Quoted 4 lines

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 57 lines · Yanfei
Quoted 51 lines · Richard Purdie
Quoted 35 lines · Yanfei

From: Yanfei Xu <[email protected]>

Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copied iamge for these filesystems instead of symlink.

---
  meta/classes/kernel.bbclass | 10 +++++++++-

  1 file changed, 9 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +1 -0
index 41101a64a0..749d1a0f29 100644
@@ -94,6 +94,14 @@ python __anonymous () {
           d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
           d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
           d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+        d.setVar('pkg_postinst_ontarget_%s-image-%s' % 

(kname,typelower), """

meta/classes/kernel.bbclass +4 -0
+set +e
+ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+    echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support 

symlinks, falling back to copied image (%s)."

meta/classes/kernel.bbclass +3 -0
+fi
+set -e
+""" % (type, type, type))

      image = d.getVar('INITRAMFS_IMAGE')
      # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,

meta/classes/kernel.bbclass +0 -0
@@ -386,7 +394,7 @@ kernel_do_install() {

      for imageType in ${KERNEL_IMAGETYPES} ; do
          install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}

Quoted 8 lines

          if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
-            ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
+            install -m 0644 ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType} fi
      done
      install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}

I am a bit concerned about this since whilst it solves one problem, doesn't having two copies of the same file around significantly increase the size of the packages and the update payloads updating such systems would need? Are these two copies of the file in the same package or not?

Quoted 3 lines

Perhaps the symlink creation should fall back to a copy on device rather than having the copy at build time (as I understand it)?

Quoted 6 lines

I had a wrong understanding about the no-versioned Image in /boot partation from wic. And I just verified that the no-versioned Image in /boot partation seems doesn't from kernel image package. So you are right, we don't need to have the other no-versioned image in packages.

I'll change the logic to having the copy at build time in v3.

sorry, at the postinstall thread.

Quoted 12 lines

Cheers,

Yanfei

Quoted 4 lines

Cheers,

Richard

#5 lore raw
In reply to Richard Purdie
Quoted 49 lines · Richard Purdie
Quoted 32 lines · Yanfei

From: Yanfei Xu <[email protected]>

Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copied iamge for these filesystems instead of symlink.

---
 meta/classes/kernel.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +8 -0
index 41101a64a0..749d1a0f29 100644
@@ -94,6 +94,14 @@ python __anonymous () {
         d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
         d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
         d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
+        d.setVar('pkg_postinst_ontarget_%s-image-%s' % (kname,typelower), """
+set +e
+ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+    echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+fi
+set -e
+""" % (type, type, type))
 
     image = d.getVar('INITRAMFS_IMAGE')
     # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,

meta/classes/kernel.bbclass kernel_do_install() { · line 400

Quoted 8 lines
meta/classes/kernel.bbclass +1 -1
@@ -386,7 +394,7 @@ kernel_do_install() {
      for imageType in ${KERNEL_IMAGETYPES} ; do
              install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
              if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
-                     ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
+                     install -m 0644 ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
              fi
      done
      install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}

I am a bit concerned about this since whilst it solves one problem, doesn't having two copies of the same file around significantly increase the size of the packages and the update payloads updating such systems would need? Are these two copies of the file in the same package or not?

Quoted 2 lines

Perhaps the symlink creation should fall back to a copy on device rather than having the copy at build time (as I understand it)?

This was my question in v1 as well, looks like we've consolidated on that option now :D

Bruce

Quoted 5 lines

Cheers,

Richard

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II