All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel: Stop using update-alternatives
@ 2017-08-31 21:34 Otavio Salvador
  2017-09-01 17:07 ` Saul Wold
  0 siblings, 1 reply; 4+ messages in thread
From: Otavio Salvador @ 2017-08-31 21:34 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Otavio Salvador

The update-alternatives where using relative links so not being really
in use since December 2016 (see OE-Core:c7bc46b9 "kernel: Fix
symlinks") so instead we now generate the relative symlinks during the
do_install task and drop the update-alternatives use at all.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

 meta/classes/kernel.bbclass             | 16 +++------------
 meta/recipes-kernel/linux/linux-dtb.inc | 36 ++++-----------------------------
 2 files changed, 7 insertions(+), 45 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 3cc0432fcf..02a5e961cb 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -2,7 +2,7 @@ inherit linux-kernel-base kernel-module-split
 
 PROVIDES += "virtual/kernel"
 DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native"
-PACKAGE_WRITE_DEPS += "depmodwrapper-cross virtual/update-alternatives-native"
+PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
 
 do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot"
 
@@ -57,7 +57,7 @@ python __anonymous () {
 
         d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
 
-        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}')
+        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
 
         d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
 
@@ -65,13 +65,6 @@ python __anonymous () {
 
         d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
 
-        priority = d.getVar('KERNEL_PRIORITY')
-        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + 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'
-        d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
-
     image = d.getVar('INITRAMFS_IMAGE')
     if image:
         d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
@@ -137,10 +130,6 @@ export CROSS_COMPILE = "${TARGET_PREFIX}"
 export KBUILD_BUILD_USER = "oe-user"
 export KBUILD_BUILD_HOST = "oe-host"
 
-KERNEL_PRIORITY ?= "${@int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
-                       int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[1]) * 100 + \
-                       int(d.getVar('PV').split('-')[0].split('+')[0].split('.')[-1])}"
-
 KERNEL_RELEASE ?= "${KERNEL_VERSION}"
 
 # The directory where built kernel lies in the kernel tree
@@ -350,6 +339,7 @@ kernel_do_install() {
 	install -d ${D}/boot
 	for type in ${KERNEL_IMAGETYPES} ; do
 		install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
+		ln -sf ${type}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${type}
 	done
 	install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
 	install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 0174c80d85..6e6f39e640 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -1,7 +1,5 @@
 # Support for device tree generation
-FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
-
-PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
+FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
 
 python __anonymous () {
     d.appendVar("PACKAGES", " kernel-devicetree")
@@ -36,12 +34,13 @@ do_install_append() {
 	for DTB in ${KERNEL_DEVICETREE}; do
 		DTB=`normalize_dtb "${DTB}"`
 		DTB_EXT=${DTB##*.}
+		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
 		DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
+		install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
 		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
 			symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
-			install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
+			ln -sf ${DTB_BASE_NAME}.${DTB_EXT} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
 		done
 	done
 }
@@ -59,33 +58,6 @@ do_deploy_append() {
 			DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
 			install -d ${DEPLOYDIR}
 			install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
-			ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
-		done
-	done
-}
-
-pkg_postinst_kernel-devicetree () {
-	cd /${KERNEL_IMAGEDEST}
-	for DTB in ${KERNEL_DEVICETREE}; do
-		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
-			symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
-			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
-		done
-	done
-}
-
-pkg_postrm_kernel-devicetree () {
-	cd /${KERNEL_IMAGEDEST}
-	for DTB in ${KERNEL_DEVICETREE}; do
-		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
-			symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
-			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
 		done
 	done
 }
-- 
2.14.1



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

* Re: [PATCH] kernel: Stop using update-alternatives
  2017-08-31 21:34 [PATCH] kernel: Stop using update-alternatives Otavio Salvador
@ 2017-09-01 17:07 ` Saul Wold
  2017-09-01 17:36   ` Saul Wold
  2017-09-01 17:39   ` Otavio Salvador
  0 siblings, 2 replies; 4+ messages in thread
From: Saul Wold @ 2017-09-01 17:07 UTC (permalink / raw)
  To: Otavio Salvador, OpenEmbedded Core Mailing List; +Cc: Haris Okanovic

On Thu, 2017-08-31 at 18:34 -0300, Otavio Salvador wrote:
> The update-alternatives where using relative links so not being
> really
> in use since December 2016 (see OE-Core:c7bc46b9 "kernel: Fix
> symlinks") so instead we now generate the relative symlinks during
> the
> do_install task and drop the update-alternatives use at all.
> 
Is there a reason not to fix the U-A usage of the relative links?

How will this affect the installation of multiple kernels?
for example with Haris's patch: http://lists.openembedded.org/pipermail
/openembedded-core/2017-August/140996.html

Sau!


> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
> 
>  meta/classes/kernel.bbclass             | 16 +++------------
>  meta/recipes-kernel/linux/linux-dtb.inc | 36 ++++-------------------
> ----------
>  2 files changed, 7 insertions(+), 45 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass
> b/meta/classes/kernel.bbclass
> index 3cc0432fcf..02a5e961cb 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -2,7 +2,7 @@ inherit linux-kernel-base kernel-module-split
>  
>  PROVIDES += "virtual/kernel"
>  DEPENDS += "virtual/${TARGET_PREFIX}binutils
> virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native"
> -PACKAGE_WRITE_DEPS += "depmodwrapper-cross virtual/update-
> alternatives-native"
> +PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
>  
>  do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot"
>  
> @@ -57,7 +57,7 @@ python __anonymous () {
>  
>          d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
>  
> -        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest
> + '/' + type + '-${KERNEL_VERSION_NAME}')
> +        d.setVar('FILES_kernel-image-' + typelower, '/' + imagedest
> + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' +
> type)
>  
>          d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' +
> typelower)
>  
> @@ -65,13 +65,6 @@ python __anonymous () {
>  
>          d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
>  
> -        priority = d.getVar('KERNEL_PRIORITY')
> -        postinst = '#!/bin/sh\n' + 'update-alternatives --install /'
> + imagedest + '/' + type + ' ' + type + ' ' + 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'
> -        d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
> -
>      image = d.getVar('INITRAMFS_IMAGE')
>      if image:
>          d.appendVarFlag('do_bundle_initramfs', 'depends', '
> ${INITRAMFS_IMAGE}:do_image_complete')
> @@ -137,10 +130,6 @@ export CROSS_COMPILE = "${TARGET_PREFIX}"
>  export KBUILD_BUILD_USER = "oe-user"
>  export KBUILD_BUILD_HOST = "oe-host"
>  
> -KERNEL_PRIORITY ?= "${@int(d.getVar('PV').split('-
> ')[0].split('+')[0].split('.')[0]) * 10000 + \
> -                       int(d.getVar('PV').split('-
> ')[0].split('+')[0].split('.')[1]) * 100 + \
> -                       int(d.getVar('PV').split('-
> ')[0].split('+')[0].split('.')[-1])}"
> -
>  KERNEL_RELEASE ?= "${KERNEL_VERSION}"
>  
>  # The directory where built kernel lies in the kernel tree
> @@ -350,6 +339,7 @@ kernel_do_install() {
>  	install -d ${D}/boot
>  	for type in ${KERNEL_IMAGETYPES} ; do
>  		install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}
> ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
> +		ln -sf ${type}-${KERNEL_VERSION}
> ${D}/${KERNEL_IMAGEDEST}/${type}
>  	done
>  	install -m 0644 System.map ${D}/boot/System.map-
> ${KERNEL_VERSION}
>  	install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-
> kernel/linux/linux-dtb.inc
> index 0174c80d85..6e6f39e640 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -1,7 +1,5 @@
>  # Support for device tree generation
> -FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> -
> -PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
> +FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb
> /${KERNEL_IMAGEDEST}/*.dtbo"
>  
>  python __anonymous () {
>      d.appendVar("PACKAGES", " kernel-devicetree")
> @@ -36,12 +34,13 @@ do_install_append() {
>  	for DTB in ${KERNEL_DEVICETREE}; do
>  		DTB=`normalize_dtb "${DTB}"`
>  		DTB_EXT=${DTB##*.}
> +		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
>  		DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
> +		install -m 0644 ${DTB_PATH}
> ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
>  		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
>  			symlink_name=${type}"-
> "${KERNEL_IMAGE_SYMLINK_NAME}
>  			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
> "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> -			DTB_PATH=`get_real_dtb_path_in_kernel
> "${DTB}"`
> -			install -m 0644 ${DTB_PATH}
> ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
> +			ln -sf ${DTB_BASE_NAME}.${DTB_EXT}
> ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
>  		done
>  	done
>  }
> @@ -59,33 +58,6 @@ do_deploy_append() {
>  			DTB_PATH=`get_real_dtb_path_in_kernel
> "${DTB}"`
>  			install -d ${DEPLOYDIR}
>  			install -m 0644 ${DTB_PATH}
> ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
> -			ln -sf ${DTB_NAME}.${DTB_EXT}
> ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
> -		done
> -	done
> -}
> -
> -pkg_postinst_kernel-devicetree () {
> -	cd /${KERNEL_IMAGEDEST}
> -	for DTB in ${KERNEL_DEVICETREE}; do
> -		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
> -			symlink_name=${type}"-
> "${KERNEL_IMAGE_SYMLINK_NAME}
> -			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
> -		done
> -	done
> -}
> -
> -pkg_postrm_kernel-devicetree () {
> -	cd /${KERNEL_IMAGEDEST}
> -	for DTB in ${KERNEL_DEVICETREE}; do
> -		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
> -			symlink_name=${type}"-
> "${KERNEL_IMAGE_SYMLINK_NAME}
> -			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
>  		done
>  	done
>  }
> -- 
> 2.14.1
> 


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

* Re: [PATCH] kernel: Stop using update-alternatives
  2017-09-01 17:07 ` Saul Wold
@ 2017-09-01 17:36   ` Saul Wold
  2017-09-01 17:39   ` Otavio Salvador
  1 sibling, 0 replies; 4+ messages in thread
From: Saul Wold @ 2017-09-01 17:36 UTC (permalink / raw)
  To: Otavio Salvador, OpenEmbedded Core Mailing List; +Cc: Haris Okanovic

On Fri, 2017-09-01 at 10:07 -0700, Saul Wold wrote:
> On Thu, 2017-08-31 at 18:34 -0300, Otavio Salvador wrote:
> > 
> > The update-alternatives where using relative links so not being
> > really
> > in use since December 2016 (see OE-Core:c7bc46b9 "kernel: Fix
> > symlinks") so instead we now generate the relative symlinks during
> > the
> > do_install task and drop the update-alternatives use at all.
> > 
> Is there a reason not to fix the U-A usage of the relative links?
> 
> How will this affect the installation of multiple kernels?
> for example with Haris's patch: http://lists.openembedded.org/piperma
> il
> /openembedded-core/2017-August/140996.html
> 
> Sau!
> 
I chatted with Otavio and we agree this is correct.

Acked-by: Saul Wold <sgw@linux.intel.com>

Sau!

> 
> > 
> > Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> > ---
> > 
> >  meta/classes/kernel.bbclass             | 16 +++------------
> >  meta/recipes-kernel/linux/linux-dtb.inc | 36 ++++-----------------
> > --
> > ----------
> >  2 files changed, 7 insertions(+), 45 deletions(-)
> > 
> > diff --git a/meta/classes/kernel.bbclass
> > b/meta/classes/kernel.bbclass
> > index 3cc0432fcf..02a5e961cb 100644
> > --- a/meta/classes/kernel.bbclass
> > +++ b/meta/classes/kernel.bbclass
> > @@ -2,7 +2,7 @@ inherit linux-kernel-base kernel-module-split
> >  
> >  PROVIDES += "virtual/kernel"
> >  DEPENDS += "virtual/${TARGET_PREFIX}binutils
> > virtual/${TARGET_PREFIX}gcc kmod-native bc-native lzop-native"
> > -PACKAGE_WRITE_DEPS += "depmodwrapper-cross virtual/update-
> > alternatives-native"
> > +PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
> >  
> >  do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot"
> >  
> > @@ -57,7 +57,7 @@ python __anonymous () {
> >  
> >          d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
> >  
> > -        d.setVar('FILES_kernel-image-' + typelower, '/' +
> > imagedest
> > + '/' + type + '-${KERNEL_VERSION_NAME}')
> > +        d.setVar('FILES_kernel-image-' + typelower, '/' +
> > imagedest
> > + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' +
> > type)
> >  
> >          d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' 
> > +
> > typelower)
> >  
> > @@ -65,13 +65,6 @@ python __anonymous () {
> >  
> >          d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
> >  
> > -        priority = d.getVar('KERNEL_PRIORITY')
> > -        postinst = '#!/bin/sh\n' + 'update-alternatives --install
> > /'
> > + imagedest + '/' + type + ' ' + type + ' ' + 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'
> > -        d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
> > -
> >      image = d.getVar('INITRAMFS_IMAGE')
> >      if image:
> >          d.appendVarFlag('do_bundle_initramfs', 'depends', '
> > ${INITRAMFS_IMAGE}:do_image_complete')
> > @@ -137,10 +130,6 @@ export CROSS_COMPILE = "${TARGET_PREFIX}"
> >  export KBUILD_BUILD_USER = "oe-user"
> >  export KBUILD_BUILD_HOST = "oe-host"
> >  
> > -KERNEL_PRIORITY ?= "${@int(d.getVar('PV').split('-
> > ')[0].split('+')[0].split('.')[0]) * 10000 + \
> > -                       int(d.getVar('PV').split('-
> > ')[0].split('+')[0].split('.')[1]) * 100 + \
> > -                       int(d.getVar('PV').split('-
> > ')[0].split('+')[0].split('.')[-1])}"
> > -
> >  KERNEL_RELEASE ?= "${KERNEL_VERSION}"
> >  
> >  # The directory where built kernel lies in the kernel tree
> > @@ -350,6 +339,7 @@ kernel_do_install() {
> >  	install -d ${D}/boot
> >  	for type in ${KERNEL_IMAGETYPES} ; do
> >  		install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}
> > ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
> > +		ln -sf ${type}-${KERNEL_VERSION}
> > ${D}/${KERNEL_IMAGEDEST}/${type}
> >  	done
> >  	install -m 0644 System.map ${D}/boot/System.map-
> > ${KERNEL_VERSION}
> >  	install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
> > diff --git a/meta/recipes-kernel/linux/linux-dtb.inc
> > b/meta/recipes-
> > kernel/linux/linux-dtb.inc
> > index 0174c80d85..6e6f39e640 100644
> > --- a/meta/recipes-kernel/linux/linux-dtb.inc
> > +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> > @@ -1,7 +1,5 @@
> >  # Support for device tree generation
> > -FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
> > -
> > -PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
> > +FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb
> > /${KERNEL_IMAGEDEST}/*.dtbo"
> >  
> >  python __anonymous () {
> >      d.appendVar("PACKAGES", " kernel-devicetree")
> > @@ -36,12 +34,13 @@ do_install_append() {
> >  	for DTB in ${KERNEL_DEVICETREE}; do
> >  		DTB=`normalize_dtb "${DTB}"`
> >  		DTB_EXT=${DTB##*.}
> > +		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
> >  		DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
> > +		install -m 0644 ${DTB_PATH}
> > ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
> >  		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
> >  			symlink_name=${type}"-
> > "${KERNEL_IMAGE_SYMLINK_NAME}
> >  			DTB_SYMLINK_NAME=`echo ${symlink_name} |
> > sed
> > "s/${MACHINE}/${DTB_BASE_NAME}/g"`
> > -			DTB_PATH=`get_real_dtb_path_in_kernel
> > "${DTB}"`
> > -			install -m 0644 ${DTB_PATH}
> > ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
> > +			ln -sf ${DTB_BASE_NAME}.${DTB_EXT}
> > ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
> >  		done
> >  	done
> >  }
> > @@ -59,33 +58,6 @@ do_deploy_append() {
> >  			DTB_PATH=`get_real_dtb_path_in_kernel
> > "${DTB}"`
> >  			install -d ${DEPLOYDIR}
> >  			install -m 0644 ${DTB_PATH}
> > ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
> > -			ln -sf ${DTB_NAME}.${DTB_EXT}
> > ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
> > -		done
> > -	done
> > -}
> > -
> > -pkg_postinst_kernel-devicetree () {
> > -	cd /${KERNEL_IMAGEDEST}
> > -	for DTB in ${KERNEL_DEVICETREE}; do
> > -		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
> > -			symlink_name=${type}"-
> > "${KERNEL_IMAGE_SYMLINK_NAME}
> > -			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
> > -		done
> > -	done
> > -}
> > -
> > -pkg_postrm_kernel-devicetree () {
> > -	cd /${KERNEL_IMAGEDEST}
> > -	for DTB in ${KERNEL_DEVICETREE}; do
> > -		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
> > -			symlink_name=${type}"-
> > "${KERNEL_IMAGE_SYMLINK_NAME}
> > -			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
> >  		done
> >  	done
> >  }
> > -- 
> > 2.14.1
> > 


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

* Re: [PATCH] kernel: Stop using update-alternatives
  2017-09-01 17:07 ` Saul Wold
  2017-09-01 17:36   ` Saul Wold
@ 2017-09-01 17:39   ` Otavio Salvador
  1 sibling, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2017-09-01 17:39 UTC (permalink / raw)
  To: Saul Wold; +Cc: Haris Okanovic, Otavio Salvador, OpenEmbedded Core Mailing List

On Fri, Sep 1, 2017 at 2:07 PM, Saul Wold <sgw@linux.intel.com> wrote:
> On Thu, 2017-08-31 at 18:34 -0300, Otavio Salvador wrote:
>> The update-alternatives where using relative links so not being
>> really
>> in use since December 2016 (see OE-Core:c7bc46b9 "kernel: Fix
>> symlinks") so instead we now generate the relative symlinks during
>> the
>> do_install task and drop the update-alternatives use at all.
>>
> Is there a reason not to fix the U-A usage of the relative links?

Conceptually the update-alternatives use is wrong as the database is
on /etc and /boot can potentially be in another partition and loaded
directly so relative links are required ...

In fact using symbolic links is not used in generic distributions as
they generate the boot script as post inst action so user can choose
which to boot but for our use case, it makes sense.


> How will this affect the installation of multiple kernels?
> for example with Haris's patch: http://lists.openembedded.org/pipermail
> /openembedded-core/2017-August/140996.html

It can be adapted to work with it; we could, for example, use the
KERNEL_NAME to be a prefix or suffix for the image and device tree
binaries.

-- 
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] 4+ messages in thread

end of thread, other threads:[~2017-09-01 17:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-31 21:34 [PATCH] kernel: Stop using update-alternatives Otavio Salvador
2017-09-01 17:07 ` Saul Wold
2017-09-01 17:36   ` Saul Wold
2017-09-01 17:39   ` Otavio Salvador

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.