All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "kernel: Fix symlinks"
@ 2017-08-16 18:15 Otavio Salvador
  2017-08-18 12:44 ` Otavio Salvador
  0 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2017-08-16 18:15 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Christopher Larson, Otavio Salvador

This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.

The commit has broken the alternatives concept as it is managed by
links controlled by the alternatives system. That said the failing
case identified (which some bootloaders fail to load the file) seems
to be due a misuse of the alternative system.

Cc: Christopher Larson <chris_larson@mentor.com>
Cc: Ross Burton <ross.burton@intel.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

---

 meta/classes/kernel.bbclass             | 6 +++---
 meta/recipes-kernel/linux/linux-dtb.inc | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 7a134d5c29..2622ada6f5 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -49,11 +49,10 @@ python __anonymous () {
 
     for type in types.split():
         typelower = type.lower()
-        imagedest = d.getVar('KERNEL_IMAGEDEST')
 
         d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
 
-        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
+        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '-${KERNEL_VERSION_NAME}')
 
         d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
 
@@ -61,8 +60,9 @@ python __anonymous () {
 
         d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
 
+        imagedest = d.getVar('KERNEL_IMAGEDEST')
         priority = d.getVar('KERNEL_PRIORITY')
-        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
+        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
         d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
 
         postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 0174c80d85..6c0462126b 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -72,7 +72,7 @@ pkg_postinst_kernel-devicetree () {
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
@@ -85,7 +85,7 @@ pkg_postrm_kernel-devicetree () {
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
-- 
2.14.1



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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-08-16 18:15 [PATCH] Revert "kernel: Fix symlinks" Otavio Salvador
@ 2017-08-18 12:44 ` Otavio Salvador
  2017-08-22 15:40   ` David Vincent
  0 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2017-08-18 12:44 UTC (permalink / raw)
  To: Otavio Salvador, David Vincent
  Cc: Christopher Larson, OpenEmbedded Core Mailing List

On Wed, Aug 16, 2017 at 3:15 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>
> The commit has broken the alternatives concept as it is managed by
> links controlled by the alternatives system. That said the failing
> case identified (which some bootloaders fail to load the file) seems
> to be due a misuse of the alternative system.
>
> Cc: Christopher Larson <chris_larson@mentor.com>
> Cc: Ross Burton <ross.burton@intel.com>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

I ended forgetting to add the commit author on Cc. Adding now :-)

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-08-18 12:44 ` Otavio Salvador
@ 2017-08-22 15:40   ` David Vincent
  2017-08-30 21:16     ` Otavio Salvador
  0 siblings, 1 reply; 12+ messages in thread
From: David Vincent @ 2017-08-22 15:40 UTC (permalink / raw)
  To: Otavio Salvador
  Cc: Christopher Larson, Otavio Salvador, OpenEmbedded Core Mailing List

On vendredi 18 août 2017 14:44:30 CEST Otavio Salvador wrote:
> On Wed, Aug 16, 2017 at 3:15 PM, Otavio Salvador
> 
> <otavio@ossystems.com.br> wrote:
> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
> > 
> > The commit has broken the alternatives concept as it is managed by
> > links controlled by the alternatives system. That said the failing
> > case identified (which some bootloaders fail to load the file) seems
> > to be due a misuse of the alternative system.
> > 
> > Cc: Christopher Larson <chris_larson@mentor.com>
> > Cc: Ross Burton <ross.burton@intel.com>
> > Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> 
> I ended forgetting to add the commit author on Cc. Adding now :-)

This issue has been discussed here : http://lists.openembedded.org/pipermail/
openembedded-core/2017-April/135923.html

Reverting this patch to solve the alternative problem cannot be a definitive 
solution as it breaks boot on some boards. IMHO, I'd rather break the 
alternative system than boot (full disclosure : I use opkg's update-
alternatives).

As already said, absolute paths cannot be used in bootloaders since it may 
point to an invalid location (rootfs may not be mounted). I do not have 
another solution with plain 'ls', but I think we should find a way to better 
handle all cases than going back and forth on this patch.

FYI, this is my use case : I have a bootloader which resides in EEPROM, but 
needs to boot kernels that can be upgraded. Therefore, I rely on a fixed path 
to the last kernel / devicetree on a specific partition outside rootfs.

--
David


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-08-22 15:40   ` David Vincent
@ 2017-08-30 21:16     ` Otavio Salvador
  2017-08-31 20:31       ` Otavio Salvador
  0 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2017-08-30 21:16 UTC (permalink / raw)
  To: David Vincent, Burton, Ross, Richard Purdie
  Cc: Christopher Larson, Otavio Salvador, OpenEmbedded Core Mailing List

David,

On Tue, Aug 22, 2017 at 12:40 PM, David Vincent <freesilicon@gmail.com> wrote:
> On vendredi 18 août 2017 14:44:30 CEST Otavio Salvador wrote:
>> On Wed, Aug 16, 2017 at 3:15 PM, Otavio Salvador
>>
>> <otavio@ossystems.com.br> wrote:
>> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>> >
>> > The commit has broken the alternatives concept as it is managed by
>> > links controlled by the alternatives system. That said the failing
>> > case identified (which some bootloaders fail to load the file) seems
>> > to be due a misuse of the alternative system.
>> >
>> > Cc: Christopher Larson <chris_larson@mentor.com>
>> > Cc: Ross Burton <ross.burton@intel.com>
>> > Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>>
>> I ended forgetting to add the commit author on Cc. Adding now :-)
>
> This issue has been discussed here : http://lists.openembedded.org/pipermail/
> openembedded-core/2017-April/135923.html
>
> Reverting this patch to solve the alternative problem cannot be a definitive
> solution as it breaks boot on some boards. IMHO, I'd rather break the
> alternative system than boot (full disclosure : I use opkg's update-
> alternatives).
>
> As already said, absolute paths cannot be used in bootloaders since it may
> point to an invalid location (rootfs may not be mounted). I do not have
> another solution with plain 'ls', but I think we should find a way to better
> handle all cases than going back and forth on this patch.
>
> FYI, this is my use case : I have a bootloader which resides in EEPROM, but
> needs to boot kernels that can be upgraded. Therefore, I rely on a fixed path
> to the last kernel / devicetree on a specific partition outside rootfs.

I understand the problem you are fixing but the solution in use is wrong.

We should stop using the update-alternatives for the kernel and device
tree files and instead just use plain symbolic links. Abusing of
update-alternatives is just wrong.

In fact, the update-alternatives for this specific use case is broken
as the database is elsewhere and so the link cannot be managed
properly.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-08-30 21:16     ` Otavio Salvador
@ 2017-08-31 20:31       ` Otavio Salvador
  0 siblings, 0 replies; 12+ messages in thread
From: Otavio Salvador @ 2017-08-31 20:31 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: OpenEmbedded Core Mailing List, Christopher Larson

Hello guys,

On Wed, Aug 30, 2017 at 6:16 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> On Tue, Aug 22, 2017 at 12:40 PM, David Vincent <freesilicon@gmail.com> wrote:
>> On vendredi 18 août 2017 14:44:30 CEST Otavio Salvador wrote:
>>> On Wed, Aug 16, 2017 at 3:15 PM, Otavio Salvador
>>>
>>> <otavio@ossystems.com.br> wrote:
>>> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>>> >
>>> > The commit has broken the alternatives concept as it is managed by
>>> > links controlled by the alternatives system. That said the failing
>>> > case identified (which some bootloaders fail to load the file) seems
>>> > to be due a misuse of the alternative system.
>>> >
>>> > Cc: Christopher Larson <chris_larson@mentor.com>
>>> > Cc: Ross Burton <ross.burton@intel.com>
>>> > Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>>>
>>> I ended forgetting to add the commit author on Cc. Adding now :-)
>>
>> This issue has been discussed here : http://lists.openembedded.org/pipermail/
>> openembedded-core/2017-April/135923.html
>>
>> Reverting this patch to solve the alternative problem cannot be a definitive
>> solution as it breaks boot on some boards. IMHO, I'd rather break the
>> alternative system than boot (full disclosure : I use opkg's update-
>> alternatives).
>>
>> As already said, absolute paths cannot be used in bootloaders since it may
>> point to an invalid location (rootfs may not be mounted). I do not have
>> another solution with plain 'ls', but I think we should find a way to better
>> handle all cases than going back and forth on this patch.
>>
>> FYI, this is my use case : I have a bootloader which resides in EEPROM, but
>> needs to boot kernels that can be upgraded. Therefore, I rely on a fixed path
>> to the last kernel / devicetree on a specific partition outside rootfs.
>
> I understand the problem you are fixing but the solution in use is wrong.
>
> We should stop using the update-alternatives for the kernel and device
> tree files and instead just use plain symbolic links. Abusing of
> update-alternatives is just wrong.
>
> In fact, the update-alternatives for this specific use case is broken
> as the database is elsewhere and so the link cannot be managed
> properly.

I am struggling on how to properly fix this problem ...

 - update-alternatives: due the use of a central database and the full
path links, some bootloaders are broken

 - using plain symbolic links is problematic especially when we remove
a kernel package. What should we do?

The plain symbolic link seems to be the best option but it does not
allow that multiple kernel versions are going to be installed in
parallel.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 22:04         ` Andrea Adami
@ 2017-04-24  7:44           ` David Vincent
  0 siblings, 0 replies; 12+ messages in thread
From: David Vincent @ 2017-04-24  7:44 UTC (permalink / raw)
  To: Andrea Adami; +Cc: OE-core

On samedi 22 avril 2017 00:04:34 CEST Andrea Adami wrote:
> 
> We lived for years with the relative symlink.
> 
> Then  78ee4d8  broke the bootloaders in 2014
> Finally it was reverted end 2016 and now it is under review again...ouch
> 
> What broke what?
> 
> My point is, while I had the sources and could modify and reflash the
> bootloader, the same is not valid for many people.
> 
> Anyway, I have found out that there was a workaround to allow boot from NFS:
> 
> +ROOTFS_POSTPROCESS_COMMAND += "make_zimage_symlink_relative;"

This works at image level, it is not package upgrade safe. IMHO, the symlinks 
must be relative (like every other distro) and therefore should not be 
maintained with update-alternatives (postinstall task should use plain 'ln')

> 
> Cheers
> Andrea

David


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 12:48       ` Andreas Oberritter
@ 2017-04-21 22:04         ` Andrea Adami
  2017-04-24  7:44           ` David Vincent
  0 siblings, 1 reply; 12+ messages in thread
From: Andrea Adami @ 2017-04-21 22:04 UTC (permalink / raw)
  To: Andreas Oberritter; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]

On Fri, Apr 21, 2017 at 2:48 PM, Andreas Oberritter <obi@opendreambox.org>
wrote:
> On Fri, 21 Apr 2017 14:37:36 +0200
> David Vincent <freesilicon@gmail.com> wrote:
>
>> On 2017-04-21 13:30 GMT+02:00 Andreas Oberritter <obi@opendreambox.org>:
>> > On Fri, 21 Apr 2017 13:02:51 +0200
>> > Andrea Adami <andrea.adami@gmail.com> wrote:
>> >
>> >> On Fri, Apr 21, 2017 at 12:39 PM, Andreas Oberritter
>> >> <obi@opendreambox.org> wrote:
>> >> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>> >> >
>> >> > It broke dpkg's update-alternatives, which requires absolute paths.
>> >>
>> >> This is really uncommon.
>> >
>> > Actually it's not. Try it on any Debian or Ubuntu system.
>> >
>> >> I had already expressed my negative opinion about absolute paths for
kernel [1].
>> >> Personally, I had to patch the bootloader (kexecboot).
>>
>> Same here, that's why I submitted it in the first place. Didn't
>> thought that would break dpkg...
>>
>> >>
>> >> So please try some workaround instead of changing it back.
>> >
>> > Well, there's no workaround. Other than opkg's update-alternatives,
dpkg's maintains
>> > an alternatives database in /etc/alternatives, so the symlink is going
to point to
>> > an absolute path outside of /boot anyway.
>>
>> The problem is that, for bootloaders, it is not always possible to
>> mount the rootfs. So, it must only rely on information in the boot
>> partition that can be mounted anywhere.
>
> I understand the problem the patch tried to address.
>
> Those bootloaders don't find the kernel by chance. The name of the image
> is usually set in the environment. You can update the environment in
postinst-
> scripts or just change the name of the kernel image to match the
bootloader's
> expectations, just to name some alternatives.
>
>> >
>> > To fix your problem, kernel.bbclass should be changed to not use
update-alternatives
>> > at all. But it's definitely wrong to break the original u-a by using
invalid command-
>> > line arguments.
>> >
>>
>> And reverting this patch breaks boot for those who rely on a relative
>> symlink ; that is also wrong.
>
> Yes. However, I'd argue that a regression is worse than a problem that
> persisted for years.

We lived for years with the relative symlink.

Then  78ee4d8  broke the bootloaders in 2014
Finally it was reverted end 2016 and now it is under review again...ouch

What broke what?

My point is, while I had the sources and could modify and reflash the
bootloader, the same is not valid for many people.

Anyway, I have found out that there was a workaround to allow boot from NFS:

+ROOTFS_POSTPROCESS_COMMAND += "make_zimage_symlink_relative;"

Cheers
Andrea

[-- Attachment #2: Type: text/html, Size: 3600 bytes --]

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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 12:37     ` David Vincent
@ 2017-04-21 12:48       ` Andreas Oberritter
  2017-04-21 22:04         ` Andrea Adami
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Oberritter @ 2017-04-21 12:48 UTC (permalink / raw)
  To: David Vincent; +Cc: OE-core

On Fri, 21 Apr 2017 14:37:36 +0200
David Vincent <freesilicon@gmail.com> wrote:

> On 2017-04-21 13:30 GMT+02:00 Andreas Oberritter <obi@opendreambox.org>:
> > On Fri, 21 Apr 2017 13:02:51 +0200
> > Andrea Adami <andrea.adami@gmail.com> wrote:
> >  
> >> On Fri, Apr 21, 2017 at 12:39 PM, Andreas Oberritter
> >> <obi@opendreambox.org> wrote:  
> >> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
> >> >
> >> > It broke dpkg's update-alternatives, which requires absolute paths.  
> >>
> >> This is really uncommon.  
> >
> > Actually it's not. Try it on any Debian or Ubuntu system.
> >  
> >> I had already expressed my negative opinion about absolute paths for kernel [1].
> >> Personally, I had to patch the bootloader (kexecboot).  
> 
> Same here, that's why I submitted it in the first place. Didn't
> thought that would break dpkg...
> 
> >>
> >> So please try some workaround instead of changing it back.  
> >
> > Well, there's no workaround. Other than opkg's update-alternatives, dpkg's maintains
> > an alternatives database in /etc/alternatives, so the symlink is going to point to
> > an absolute path outside of /boot anyway.  
> 
> The problem is that, for bootloaders, it is not always possible to
> mount the rootfs. So, it must only rely on information in the boot
> partition that can be mounted anywhere.

I understand the problem the patch tried to address.

Those bootloaders don't find the kernel by chance. The name of the image
is usually set in the environment. You can update the environment in postinst-
scripts or just change the name of the kernel image to match the bootloader's
expectations, just to name some alternatives.

> >
> > To fix your problem, kernel.bbclass should be changed to not use update-alternatives
> > at all. But it's definitely wrong to break the original u-a by using invalid command-
> > line arguments.
> >  
> 
> And reverting this patch breaks boot for those who rely on a relative
> symlink ; that is also wrong.

Yes. However, I'd argue that a regression is worse than a problem that
persisted for years.

Regards,
Andreas


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 11:30   ` Andreas Oberritter
@ 2017-04-21 12:37     ` David Vincent
  2017-04-21 12:48       ` Andreas Oberritter
  0 siblings, 1 reply; 12+ messages in thread
From: David Vincent @ 2017-04-21 12:37 UTC (permalink / raw)
  To: Andreas Oberritter; +Cc: OE-core

On 2017-04-21 13:30 GMT+02:00 Andreas Oberritter <obi@opendreambox.org>:
> On Fri, 21 Apr 2017 13:02:51 +0200
> Andrea Adami <andrea.adami@gmail.com> wrote:
>
>> On Fri, Apr 21, 2017 at 12:39 PM, Andreas Oberritter
>> <obi@opendreambox.org> wrote:
>> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>> >
>> > It broke dpkg's update-alternatives, which requires absolute paths.
>>
>> This is really uncommon.
>
> Actually it's not. Try it on any Debian or Ubuntu system.
>
>> I had already expressed my negative opinion about absolute paths for kernel [1].
>> Personally, I had to patch the bootloader (kexecboot).

Same here, that's why I submitted it in the first place. Didn't
thought that would break dpkg...

>>
>> So please try some workaround instead of changing it back.
>
> Well, there's no workaround. Other than opkg's update-alternatives, dpkg's maintains
> an alternatives database in /etc/alternatives, so the symlink is going to point to
> an absolute path outside of /boot anyway.

The problem is that, for bootloaders, it is not always possible to
mount the rootfs. So, it must only rely on information in the boot
partition that can be mounted anywhere.

>
> To fix your problem, kernel.bbclass should be changed to not use update-alternatives
> at all. But it's definitely wrong to break the original u-a by using invalid command-
> line arguments.
>

And reverting this patch breaks boot for those who rely on a relative
symlink ; that is also wrong. Maybe you're right and
update-alternatives should be abandoned altogether for managing kernel
symlinks.

> Regards,
> Andreas
>
>
>> Cheers
>> Andrea

David

>>
>> [1] http://lists.openembedded.org/pipermail/openembedded-core/2014-July/093988.html
>>
>> >
>> > | update-alternatives: error: alternative path is not absolute as it should be
>> >
>> > Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
>> > ---
>> >  meta/classes/kernel.bbclass             | 6 +++---
>> >  meta/recipes-kernel/linux/linux-dtb.inc | 4 ++--
>> >  2 files changed, 5 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> > index 12a748d..8cf357f 100644
>> > --- a/meta/classes/kernel.bbclass
>> > +++ b/meta/classes/kernel.bbclass
>> > @@ -49,11 +49,10 @@ python __anonymous () {
>> >
>> >      for type in types.split():
>> >          typelower = type.lower()
>> > -        imagedest = d.getVar('KERNEL_IMAGEDEST')
>> >
>> >          d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
>> >
>> > -        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
>> > +        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '-${KERNEL_VERSION_NAME}')
>> >
>> >          d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
>> >
>> > @@ -61,8 +60,9 @@ python __anonymous () {
>> >
>> >          d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
>> >
>> > +        imagedest = d.getVar('KERNEL_IMAGEDEST')
>> >          priority = d.getVar('KERNEL_PRIORITY')
>> > -        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
>> > +        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
>> >          d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
>> >
>> >          postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
>> > diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
>> > index 22e374f..41aad7c 100644
>> > --- a/meta/recipes-kernel/linux/linux-dtb.inc
>> > +++ b/meta/recipes-kernel/linux/linux-dtb.inc
>> > @@ -63,7 +63,7 @@ pkg_postinst_kernel-devicetree () {
>> >                         DTB_EXT=${DTB##*.}
>> >                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
>> >                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
>> > -                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>> > +                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>> >                 done
>> >         done
>> >  }
>> > @@ -76,7 +76,7 @@ pkg_postrm_kernel-devicetree () {
>> >                         DTB_EXT=${DTB##*.}
>> >                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
>> >                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
>> > -                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>> > +                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>> >                 done
>> >         done
>> >  }
>> > --
>> > 2.7.4
>> >
>> > --
>> > _______________________________________________
>> > Openembedded-core mailing list
>> > Openembedded-core@lists.openembedded.org
>> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 11:02 ` Andrea Adami
@ 2017-04-21 11:30   ` Andreas Oberritter
  2017-04-21 12:37     ` David Vincent
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Oberritter @ 2017-04-21 11:30 UTC (permalink / raw)
  To: Andrea Adami; +Cc: openembedded-core

On Fri, 21 Apr 2017 13:02:51 +0200
Andrea Adami <andrea.adami@gmail.com> wrote:

> On Fri, Apr 21, 2017 at 12:39 PM, Andreas Oberritter
> <obi@opendreambox.org> wrote:
> > This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
> >
> > It broke dpkg's update-alternatives, which requires absolute paths.  
> 
> This is really uncommon.

Actually it's not. Try it on any Debian or Ubuntu system.

> I had already expressed my negative opinion about absolute paths for kernel [1].
> Personally, I had to patch the bootloader (kexecboot).
> 
> So please try some workaround instead of changing it back.

Well, there's no workaround. Other than opkg's update-alternatives, dpkg's maintains
an alternatives database in /etc/alternatives, so the symlink is going to point to
an absolute path outside of /boot anyway.

To fix your problem, kernel.bbclass should be changed to not use update-alternatives
at all. But it's definitely wrong to break the original u-a by using invalid command-
line arguments.

Regards,
Andreas


> Cheers
> Andrea
> 
> [1] http://lists.openembedded.org/pipermail/openembedded-core/2014-July/093988.html
> 
> >
> > | update-alternatives: error: alternative path is not absolute as it should be
> >
> > Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
> > ---
> >  meta/classes/kernel.bbclass             | 6 +++---
> >  meta/recipes-kernel/linux/linux-dtb.inc | 4 ++--
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> > index 12a748d..8cf357f 100644
> > --- a/meta/classes/kernel.bbclass
> > +++ b/meta/classes/kernel.bbclass
> > @@ -49,11 +49,10 @@ python __anonymous () {
> >
> >      for type in types.split():
> >          typelower = type.lower()
> > -        imagedest = d.getVar('KERNEL_IMAGEDEST')
> >
> >          d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
> >
> > -        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
> > +        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '-${KERNEL_VERSION_NAME}')
> >
> >          d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
> >
> > @@ -61,8 +60,9 @@ python __anonymous () {
> >
> >          d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
> >
> > +        imagedest = d.getVar('KERNEL_IMAGEDEST')
> >          priority = d.getVar('KERNEL_PRIORITY')
> > -        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
> > +        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
> >          d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
> >
> >          postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
> > diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> > index 22e374f..41aad7c 100644
> > --- a/meta/recipes-kernel/linux/linux-dtb.inc
> > +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> > @@ -63,7 +63,7 @@ pkg_postinst_kernel-devicetree () {
> >                         DTB_EXT=${DTB##*.}
> >                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
> >                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> > -                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> > +                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> >                 done
> >         done
> >  }
> > @@ -76,7 +76,7 @@ pkg_postrm_kernel-devicetree () {
> >                         DTB_EXT=${DTB##*.}
> >                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
> >                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> > -                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> > +                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> >                 done
> >         done
> >  }
> > --
> > 2.7.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core  



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

* Re: [PATCH] Revert "kernel: Fix symlinks"
  2017-04-21 10:39 Andreas Oberritter
@ 2017-04-21 11:02 ` Andrea Adami
  2017-04-21 11:30   ` Andreas Oberritter
  0 siblings, 1 reply; 12+ messages in thread
From: Andrea Adami @ 2017-04-21 11:02 UTC (permalink / raw)
  To: Andreas Oberritter; +Cc: openembedded-core

On Fri, Apr 21, 2017 at 12:39 PM, Andreas Oberritter
<obi@opendreambox.org> wrote:
> This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.
>
> It broke dpkg's update-alternatives, which requires absolute paths.

This is really uncommon.

I had already expressed my negative opinion about absolute paths for kernel [1].
Personally, I had to patch the bootloader (kexecboot).

So please try some workaround instead of changing it back.

Cheers
Andrea

[1] http://lists.openembedded.org/pipermail/openembedded-core/2014-July/093988.html

>
> | update-alternatives: error: alternative path is not absolute as it should be
>
> Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
> ---
>  meta/classes/kernel.bbclass             | 6 +++---
>  meta/recipes-kernel/linux/linux-dtb.inc | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 12a748d..8cf357f 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -49,11 +49,10 @@ python __anonymous () {
>
>      for type in types.split():
>          typelower = type.lower()
> -        imagedest = d.getVar('KERNEL_IMAGEDEST')
>
>          d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
>
> -        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
> +        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '-${KERNEL_VERSION_NAME}')
>
>          d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
>
> @@ -61,8 +60,9 @@ python __anonymous () {
>
>          d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
>
> +        imagedest = d.getVar('KERNEL_IMAGEDEST')
>          priority = d.getVar('KERNEL_PRIORITY')
> -        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
> +        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
>          d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
>
>          postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> index 22e374f..41aad7c 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -63,7 +63,7 @@ pkg_postinst_kernel-devicetree () {
>                         DTB_EXT=${DTB##*.}
>                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
>                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> -                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> +                       update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>                 done
>         done
>  }
> @@ -76,7 +76,7 @@ pkg_postrm_kernel-devicetree () {
>                         DTB_EXT=${DTB##*.}
>                         DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
>                         DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> -                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
> +                       update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
>                 done
>         done
>  }
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* [PATCH] Revert "kernel: Fix symlinks"
@ 2017-04-21 10:39 Andreas Oberritter
  2017-04-21 11:02 ` Andrea Adami
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Oberritter @ 2017-04-21 10:39 UTC (permalink / raw)
  To: openembedded-core

This reverts commit c7bc46b9bc29dd0953ab8d63b50fa105bb66892e.

It broke dpkg's update-alternatives, which requires absolute paths.

| update-alternatives: error: alternative path is not absolute as it should be

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
---
 meta/classes/kernel.bbclass             | 6 +++---
 meta/recipes-kernel/linux/linux-dtb.inc | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 12a748d..8cf357f 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -49,11 +49,10 @@ python __anonymous () {
 
     for type in types.split():
         typelower = type.lower()
-        imagedest = d.getVar('KERNEL_IMAGEDEST')
 
         d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
 
-        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
+        d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '-${KERNEL_VERSION_NAME}')
 
         d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
 
@@ -61,8 +60,9 @@ python __anonymous () {
 
         d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
 
+        imagedest = d.getVar('KERNEL_IMAGEDEST')
         priority = d.getVar('KERNEL_PRIORITY')
-        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
+        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
         d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
 
         postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 22e374f..41aad7c 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -63,7 +63,7 @@ pkg_postinst_kernel-devicetree () {
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
@@ -76,7 +76,7 @@ pkg_postrm_kernel-devicetree () {
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
-- 
2.7.4



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

end of thread, other threads:[~2017-08-31 20:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-16 18:15 [PATCH] Revert "kernel: Fix symlinks" Otavio Salvador
2017-08-18 12:44 ` Otavio Salvador
2017-08-22 15:40   ` David Vincent
2017-08-30 21:16     ` Otavio Salvador
2017-08-31 20:31       ` Otavio Salvador
  -- strict thread matches above, loose matches on Subject: below --
2017-04-21 10:39 Andreas Oberritter
2017-04-21 11:02 ` Andrea Adami
2017-04-21 11:30   ` Andreas Oberritter
2017-04-21 12:37     ` David Vincent
2017-04-21 12:48       ` Andreas Oberritter
2017-04-21 22:04         ` Andrea Adami
2017-04-24  7:44           ` David Vincent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.