All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
@ 2015-09-29 13:27 Richard Purdie
  2015-09-29 17:09 ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2015-09-29 13:27 UTC (permalink / raw)
  To: openembedded-core

Prelinking on x86-64 wasn't working out the box as it uses /lib and
not /lib64 for libs. Prelink was refusing to link as the dynamic loader
didn't match its idea of the right path. Passing in the --dyanmic-linker
option avoids this.

We can share code from image-mklibs so abstract that into a new class,
linuxloader.bbclass.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
index c455a8e..45a66fb 100644
--- a/meta/classes/image-mklibs.bbclass
+++ b/meta/classes/image-mklibs.bbclass
@@ -2,6 +2,8 @@ do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
 
 IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
 
+inherit linuxloader
+
 mklibs_optimize_image_doit() {
 	rm -rf ${WORKDIR}/mklibs
 	mkdir -p ${WORKDIR}/mklibs/dest
@@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
 		| sed "s+^\./++" \
 		> ${WORKDIR}/mklibs/executables.list
 
-	case ${TARGET_ARCH} in
-		powerpc | mips | mipsel | microblaze )
-			dynamic_loader="${base_libdir}/ld.so.1"
-			;;
-		powerpc64)
-			dynamic_loader="${base_libdir}/ld64.so.1"
-			;;
-		x86_64)
-			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
-			;;
-		i586 )
-			dynamic_loader="${base_libdir}/ld-linux.so.2"
-			;;
-		arm )
-			dynamic_loader="${base_libdir}/ld-linux.so.3"
-			;;
-		* )
-			dynamic_loader="/unknown_dynamic_linker"
-			;;
-	esac
+	# Set $dynamic_loader 
+        linuxloader
 
 	mklibs -v \
 		--ldlib ${dynamic_loader} \
diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass
index d4bb3ae..4bb090d 100644
--- a/meta/classes/image-prelink.bbclass
+++ b/meta/classes/image-prelink.bbclass
@@ -2,6 +2,8 @@ do_rootfs[depends] += "prelink-native:do_populate_sysroot"
 
 IMAGE_PREPROCESS_COMMAND += "prelink_image; "
 
+inherit linuxloader
+
 prelink_image () {
 #	export PSEUDO_DEBUG=4
 #	/bin/env | /bin/grep PSEUDO
@@ -20,8 +22,11 @@ prelink_image () {
 		dummy_prelink_conf=false;
 	fi
 
+	# Set $dynamic_loader
+	linuxloader
+
 	# prelink!
-	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" = "true" ]; then
diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
new file mode 100644
index 0000000..578df14
--- /dev/null
+++ b/meta/classes/linuxloader.bbclass
@@ -0,0 +1,23 @@
+
+linuxloader () {
+	case ${TARGET_ARCH} in
+		powerpc | mips | mipsel | microblaze )
+			dynamic_loader="${base_libdir}/ld.so.1"
+			;;
+		powerpc64)
+			dynamic_loader="${base_libdir}/ld64.so.1"
+			;;
+		x86_64)
+			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
+			;;
+		i586 )
+			dynamic_loader="${base_libdir}/ld-linux.so.2"
+			;;
+		arm )
+			dynamic_loader="${base_libdir}/ld-linux.so.3"
+			;;
+		* )
+			dynamic_loader="/unknown_dynamic_linker"
+			;;
+	esac
+}




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

* Re: [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
  2015-09-29 13:27 [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking Richard Purdie
@ 2015-09-29 17:09 ` Khem Raj
  2016-03-04 17:23   ` Christopher Larson
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2015-09-29 17:09 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

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


> On Sep 29, 2015, at 6:27 AM, Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
> 
> Prelinking on x86-64 wasn't working out the box as it uses /lib and
> not /lib64 for libs. Prelink was refusing to link as the dynamic loader
> didn't match its idea of the right path. Passing in the --dyanmic-linker
> option avoids this.
> 
> We can share code from image-mklibs so abstract that into a new class,
> linuxloader.bbclass.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
> index c455a8e..45a66fb 100644
> --- a/meta/classes/image-mklibs.bbclass
> +++ b/meta/classes/image-mklibs.bbclass
> @@ -2,6 +2,8 @@ do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
> 
> IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
> 
> +inherit linuxloader
> +
> mklibs_optimize_image_doit() {
> 	rm -rf ${WORKDIR}/mklibs
> 	mkdir -p ${WORKDIR}/mklibs/dest
> @@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
> 		| sed "s+^\./++" \
> 		> ${WORKDIR}/mklibs/executables.list
> 
> -	case ${TARGET_ARCH} in
> -		powerpc | mips | mipsel | microblaze )
> -			dynamic_loader="${base_libdir}/ld.so.1"
> -			;;
> -		powerpc64)
> -			dynamic_loader="${base_libdir}/ld64.so.1"
> -			;;
> -		x86_64)
> -			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> -			;;
> -		i586 )
> -			dynamic_loader="${base_libdir}/ld-linux.so.2"
> -			;;
> -		arm )
> -			dynamic_loader="${base_libdir}/ld-linux.so.3"
> -			;;
> -		* )
> -			dynamic_loader="/unknown_dynamic_linker"
> -			;;
> -	esac
> +	# Set $dynamic_loader
> +        linuxloader
> 
> 	mklibs -v \
> 		--ldlib ${dynamic_loader} \
> diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass
> index d4bb3ae..4bb090d 100644
> --- a/meta/classes/image-prelink.bbclass
> +++ b/meta/classes/image-prelink.bbclass
> @@ -2,6 +2,8 @@ do_rootfs[depends] += "prelink-native:do_populate_sysroot"
> 
> IMAGE_PREPROCESS_COMMAND += "prelink_image; "
> 
> +inherit linuxloader
> +
> prelink_image () {
> #	export PSEUDO_DEBUG=4
> #	/bin/env | /bin/grep PSEUDO
> @@ -20,8 +22,11 @@ prelink_image () {
> 		dummy_prelink_conf=false;
> 	fi
> 
> +	# Set $dynamic_loader
> +	linuxloader
> +
> 	# prelink!
> -	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
> +	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
> 
> 	# Remove the prelink.conf if we had to add it.
> 	if [ "$dummy_prelink_conf" = "true" ]; then
> diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
> new file mode 100644
> index 0000000..578df14
> --- /dev/null
> +++ b/meta/classes/linuxloader.bbclass
> @@ -0,0 +1,23 @@
> +
> +linuxloader () {
> +	case ${TARGET_ARCH} in
> +		powerpc | mips | mipsel | microblaze )
> +			dynamic_loader="${base_libdir}/ld.so.1"
> +			;;
> +		powerpc64)
> +			dynamic_loader="${base_libdir}/ld64.so.1"
> +			;;
> +		x86_64)
> +			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> +			;;
> +		i586 )
> +			dynamic_loader="${base_libdir}/ld-linux.so.2"
> +			;;
> +		arm )
> +			dynamic_loader="${base_libdir}/ld-linux.so.3"
> +			;;
> +		* )
> +			dynamic_loader="/unknown_dynamic_linker"
> +			;;
> +	esac
> +}
> 
> 

For readability it would have been nice if it was returning the value from function so it could be used

myloader = call this function



> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

* Re: [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
  2015-09-29 17:09 ` Khem Raj
@ 2016-03-04 17:23   ` Christopher Larson
  2016-03-04 22:09     ` Dan McGregor
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Larson @ 2016-03-04 17:23 UTC (permalink / raw)
  To: Khem Raj, Richard Purdie; +Cc: openembedded-core

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

On Tue, Sep 29, 2015 at 10:09 AM Khem Raj <raj.khem@gmail.com> wrote:

>
> > On Sep 29, 2015, at 6:27 AM, Richard Purdie <
> richard.purdie@linuxfoundation.org> wrote:
> >
> > Prelinking on x86-64 wasn't working out the box as it uses /lib and
> > not /lib64 for libs. Prelink was refusing to link as the dynamic loader
> > didn't match its idea of the right path. Passing in the --dyanmic-linker
> > option avoids this.
> >
> > We can share code from image-mklibs so abstract that into a new class,
> > linuxloader.bbclass.
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> >
> > diff --git a/meta/classes/image-mklibs.bbclass
> b/meta/classes/image-mklibs.bbclass
> > index c455a8e..45a66fb 100644
> > --- a/meta/classes/image-mklibs.bbclass
> > +++ b/meta/classes/image-mklibs.bbclass
> > @@ -2,6 +2,8 @@ do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
> >
> > IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
> >
> > +inherit linuxloader
> > +
> > mklibs_optimize_image_doit() {
> >       rm -rf ${WORKDIR}/mklibs
> >       mkdir -p ${WORKDIR}/mklibs/dest
> > @@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
> >               | sed "s+^\./++" \
> >               > ${WORKDIR}/mklibs/executables.list
> >
> > -     case ${TARGET_ARCH} in
> > -             powerpc | mips | mipsel | microblaze )
> > -                     dynamic_loader="${base_libdir}/ld.so.1"
> > -                     ;;
> > -             powerpc64)
> > -                     dynamic_loader="${base_libdir}/ld64.so.1"
> > -                     ;;
> > -             x86_64)
> > -
>  dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> > -                     ;;
> > -             i586 )
> > -                     dynamic_loader="${base_libdir}/ld-linux.so.2"
> > -                     ;;
> > -             arm )
> > -                     dynamic_loader="${base_libdir}/ld-linux.so.3"
> > -                     ;;
> > -             * )
> > -                     dynamic_loader="/unknown_dynamic_linker"
> > -                     ;;
> > -     esac
> > +     # Set $dynamic_loader
> > +        linuxloader
> >
> >       mklibs -v \
> >               --ldlib ${dynamic_loader} \
> > diff --git a/meta/classes/image-prelink.bbclass
> b/meta/classes/image-prelink.bbclass
> > index d4bb3ae..4bb090d 100644
> > --- a/meta/classes/image-prelink.bbclass
> > +++ b/meta/classes/image-prelink.bbclass
> > @@ -2,6 +2,8 @@ do_rootfs[depends] +=
> "prelink-native:do_populate_sysroot"
> >
> > IMAGE_PREPROCESS_COMMAND += "prelink_image; "
> >
> > +inherit linuxloader
> > +
> > prelink_image () {
> > #     export PSEUDO_DEBUG=4
> > #     /bin/env | /bin/grep PSEUDO
> > @@ -20,8 +22,11 @@ prelink_image () {
> >               dummy_prelink_conf=false;
> >       fi
> >
> > +     # Set $dynamic_loader
> > +     linuxloader
> > +
> >       # prelink!
> > -     ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
> ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
> > +     ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
> ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker
> $dynamic_loader
> >
> >       # Remove the prelink.conf if we had to add it.
> >       if [ "$dummy_prelink_conf" = "true" ]; then
> > diff --git a/meta/classes/linuxloader.bbclass
> b/meta/classes/linuxloader.bbclass
> > new file mode 100644
> > index 0000000..578df14
> > --- /dev/null
> > +++ b/meta/classes/linuxloader.bbclass
> > @@ -0,0 +1,23 @@
> > +
> > +linuxloader () {
> > +     case ${TARGET_ARCH} in
> > +             powerpc | mips | mipsel | microblaze )
> > +                     dynamic_loader="${base_libdir}/ld.so.1"
> > +                     ;;
> > +             powerpc64)
> > +                     dynamic_loader="${base_libdir}/ld64.so.1"
> > +                     ;;
> > +             x86_64)
> > +
>  dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> > +                     ;;
> > +             i586 )
> > +                     dynamic_loader="${base_libdir}/ld-linux.so.2"
> > +                     ;;
> > +             arm )
> > +                     dynamic_loader="${base_libdir}/ld-linux.so.3"
> > +                     ;;
> > +             * )
> > +                     dynamic_loader="/unknown_dynamic_linker"
> > +                     ;;
> > +     esac
> > +}
> >
> >
>
> For readability it would have been nice if it was returning the value from
> function so it could be used
>
> myloader = call this function
>

Agreed, I was just thinking this could be used for UNINATIVE_LOADER in
uninative.bbclass.

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

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

* Re: [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
  2016-03-04 17:23   ` Christopher Larson
@ 2016-03-04 22:09     ` Dan McGregor
  0 siblings, 0 replies; 6+ messages in thread
From: Dan McGregor @ 2016-03-04 22:09 UTC (permalink / raw)
  To: Christopher Larson; +Cc: Patches and discussions about the oe-core layer

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

On 4 Mar 2016 11:23 a.m., "Christopher Larson" <clarson@kergoth.com> wrote:
>
>
>
> On Tue, Sep 29, 2015 at 10:09 AM Khem Raj <raj.khem@gmail.com> wrote:
>>
>>
>> > On Sep 29, 2015, at 6:27 AM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:
>> >
>> > Prelinking on x86-64 wasn't working out the box as it uses /lib and
>> > not /lib64 for libs. Prelink was refusing to link as the dynamic loader
>> > didn't match its idea of the right path. Passing in the
--dyanmic-linker
>> > option avoids this.
>> >
>> > We can share code from image-mklibs so abstract that into a new class,
>> > linuxloader.bbclass.
>> >
>> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> >
>> > diff --git a/meta/classes/image-mklibs.bbclass
b/meta/classes/image-mklibs.bbclass
>> > index c455a8e..45a66fb 100644
>> > --- a/meta/classes/image-mklibs.bbclass
>> > +++ b/meta/classes/image-mklibs.bbclass
>> > @@ -2,6 +2,8 @@ do_rootfs[depends] +=
"mklibs-native:do_populate_sysroot"
>> >
>> > IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
>> >
>> > +inherit linuxloader
>> > +
>> > mklibs_optimize_image_doit() {
>> >       rm -rf ${WORKDIR}/mklibs
>> >       mkdir -p ${WORKDIR}/mklibs/dest
>> > @@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
>> >               | sed "s+^\./++" \
>> >               > ${WORKDIR}/mklibs/executables.list
>> >
>> > -     case ${TARGET_ARCH} in
>> > -             powerpc | mips | mipsel | microblaze )
>> > -                     dynamic_loader="${base_libdir}/ld.so.1"
>> > -                     ;;
>> > -             powerpc64)
>> > -                     dynamic_loader="${base_libdir}/ld64.so.1"
>> > -                     ;;
>> > -             x86_64)
>> > -
 dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
>> > -                     ;;
>> > -             i586 )
>> > -                     dynamic_loader="${base_libdir}/ld-linux.so.2"
>> > -                     ;;
>> > -             arm )
>> > -                     dynamic_loader="${base_libdir}/ld-linux.so.3"
>> > -                     ;;
>> > -             * )
>> > -                     dynamic_loader="/unknown_dynamic_linker"
>> > -                     ;;
>> > -     esac
>> > +     # Set $dynamic_loader
>> > +        linuxloader
>> >
>> >       mklibs -v \
>> >               --ldlib ${dynamic_loader} \
>> > diff --git a/meta/classes/image-prelink.bbclass
b/meta/classes/image-prelink.bbclass
>> > index d4bb3ae..4bb090d 100644
>> > --- a/meta/classes/image-prelink.bbclass
>> > +++ b/meta/classes/image-prelink.bbclass
>> > @@ -2,6 +2,8 @@ do_rootfs[depends] +=
"prelink-native:do_populate_sysroot"
>> >
>> > IMAGE_PREPROCESS_COMMAND += "prelink_image; "
>> >
>> > +inherit linuxloader
>> > +
>> > prelink_image () {
>> > #     export PSEUDO_DEBUG=4
>> > #     /bin/env | /bin/grep PSEUDO
>> > @@ -20,8 +22,11 @@ prelink_image () {
>> >               dummy_prelink_conf=false;
>> >       fi
>> >
>> > +     # Set $dynamic_loader
>> > +     linuxloader
>> > +
>> >       # prelink!
>> > -     ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
>> > +     ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker
$dynamic_loader
>> >
>> >       # Remove the prelink.conf if we had to add it.
>> >       if [ "$dummy_prelink_conf" = "true" ]; then
>> > diff --git a/meta/classes/linuxloader.bbclass
b/meta/classes/linuxloader.bbclass
>> > new file mode 100644
>> > index 0000000..578df14
>> > --- /dev/null
>> > +++ b/meta/classes/linuxloader.bbclass
>> > @@ -0,0 +1,23 @@
>> > +
>> > +linuxloader () {
>> > +     case ${TARGET_ARCH} in
>> > +             powerpc | mips | mipsel | microblaze )
>> > +                     dynamic_loader="${base_libdir}/ld.so.1"
>> > +                     ;;
>> > +             powerpc64)
>> > +                     dynamic_loader="${base_libdir}/ld64.so.1"
>> > +                     ;;
>> > +             x86_64)
>> > +
 dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
>> > +                     ;;
>> > +             i586 )
>> > +                     dynamic_loader="${base_libdir}/ld-linux.so.2"
>> > +                     ;;
>> > +             arm )
>> > +                     dynamic_loader="${base_libdir}/ld-linux.so.3"
>> > +                     ;;
>> > +             * )
>> > +                     dynamic_loader="/unknown_dynamic_linker"
>> > +                     ;;
>> > +     esac
>> > +}
>> >
>> >
>>
>> For readability it would have been nice if it was returning the value
from function so it could be used
>>
>> myloader = call this function
>
>
> Agreed, I was just thinking this could be used for UNINATIVE_LOADER in
uninative.bbclass.
>
> --
>

This would also be handy for the go stuff I'm writing at $work.

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

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

* Re: [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
  2016-03-04 16:28 Richard Purdie
@ 2016-03-04 22:26 ` Khem Raj
  0 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2016-03-04 22:26 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

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

This looks good to me
On Mar 5, 2016 12:28 AM, "Richard Purdie" <
richard.purdie@linuxfoundation.org> wrote:

> Prelinking on x86-64 wasn't working out the box as it uses /lib and
> not /lib64 for libs. Prelink was refusing to link as the dynamic loader
> didn't match its idea of the right path. Passing in the --dyanmic-linker
> option avoids this.
>
> We can share code from image-mklibs so abstract that into a new class,
> linuxloader.bbclass.
>
> This does break prelinking of multilib images, I've opened a bug so we
> can loop back and fix that problem, the code would need to iterate the
> dynamic loaders (and setup ld.so.conf files for it).
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>
> diff --git a/meta/classes/image-mklibs.bbclass
> b/meta/classes/image-mklibs.bbclass
> index cfb3ffc..45a66fb 100644
> --- a/meta/classes/image-mklibs.bbclass
> +++ b/meta/classes/image-mklibs.bbclass
> @@ -2,6 +2,8 @@ do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
>
>  IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
>
> +inherit linuxloader
> +
>  mklibs_optimize_image_doit() {
>         rm -rf ${WORKDIR}/mklibs
>         mkdir -p ${WORKDIR}/mklibs/dest
> @@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
>                 | sed "s+^\./++" \
>                 > ${WORKDIR}/mklibs/executables.list
>
> -       case ${TARGET_ARCH} in
> -               powerpc | mips | mipsel | microblaze )
> -                       dynamic_loader="${base_libdir}/ld.so.1"
> -                       ;;
> -               powerpc64)
> -                       dynamic_loader="${base_libdir}/ld64.so.1"
> -                       ;;
> -               x86_64)
> -
>  dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> -                       ;;
> -               i*86 )
> -                       dynamic_loader="${base_libdir}/ld-linux.so.2"
> -                       ;;
> -               arm )
> -                       dynamic_loader="${base_libdir}/ld-linux.so.3"
> -                       ;;
> -               * )
> -                       dynamic_loader="/unknown_dynamic_linker"
> -                       ;;
> -       esac
> +       # Set $dynamic_loader
> +        linuxloader
>
>         mklibs -v \
>                 --ldlib ${dynamic_loader} \
> diff --git a/meta/classes/image-prelink.bbclass
> b/meta/classes/image-prelink.bbclass
> index 53c4b0b..3fe097b 100644
> --- a/meta/classes/image-prelink.bbclass
> +++ b/meta/classes/image-prelink.bbclass
> @@ -6,6 +6,8 @@ python prelink_setup () {
>      oe.utils.write_ld_so_conf(d)
>  }
>
> +inherit linuxloader
> +
>  prelink_image () {
>  #      export PSEUDO_DEBUG=4
>  #      /bin/env | /bin/grep PSEUDO
> @@ -31,8 +33,11 @@ prelink_image () {
>         fi
>         cat ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf >> $ldsoconf
>
> +       # Set $dynamic_loader
> +       linuxloader
> +
>         # prelink!
> -       ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
> ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
> +       ${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root
> ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker
> $dynamic_loader
>
>         # Remove the prelink.conf if we had to add it.
>         if [ "$dummy_prelink_conf" = "true" ]; then
> diff --git a/meta/classes/linuxloader.bbclass
> b/meta/classes/linuxloader.bbclass
> new file mode 100644
> index 0000000..af649cc
> --- /dev/null
> +++ b/meta/classes/linuxloader.bbclass
> @@ -0,0 +1,23 @@
> +
> +linuxloader () {
> +       case ${TARGET_ARCH} in
> +               powerpc | mips | mipsel | microblaze )
> +                       dynamic_loader="${base_libdir}/ld.so.1"
> +                       ;;
> +               powerpc64)
> +                       dynamic_loader="${base_libdir}/ld64.so.1"
> +                       ;;
> +               x86_64)
> +
>  dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
> +                       ;;
> +               i*86 )
> +                       dynamic_loader="${base_libdir}/ld-linux.so.2"
> +                       ;;
> +               arm )
> +                       dynamic_loader="${base_libdir}/ld-linux.so.3"
> +                       ;;
> +               * )
> +                       dynamic_loader="/unknown_dynamic_linker"
> +                       ;;
> +       esac
> +}
>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

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

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

* [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
@ 2016-03-04 16:28 Richard Purdie
  2016-03-04 22:26 ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2016-03-04 16:28 UTC (permalink / raw)
  To: openembedded-core

Prelinking on x86-64 wasn't working out the box as it uses /lib and
not /lib64 for libs. Prelink was refusing to link as the dynamic loader
didn't match its idea of the right path. Passing in the --dyanmic-linker
option avoids this.

We can share code from image-mklibs so abstract that into a new class,
linuxloader.bbclass.

This does break prelinking of multilib images, I've opened a bug so we
can loop back and fix that problem, the code would need to iterate the 
dynamic loaders (and setup ld.so.conf files for it).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
index cfb3ffc..45a66fb 100644
--- a/meta/classes/image-mklibs.bbclass
+++ b/meta/classes/image-mklibs.bbclass
@@ -2,6 +2,8 @@ do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
 
 IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
 
+inherit linuxloader
+
 mklibs_optimize_image_doit() {
 	rm -rf ${WORKDIR}/mklibs
 	mkdir -p ${WORKDIR}/mklibs/dest
@@ -15,26 +17,8 @@ mklibs_optimize_image_doit() {
 		| sed "s+^\./++" \
 		> ${WORKDIR}/mklibs/executables.list
 
-	case ${TARGET_ARCH} in
-		powerpc | mips | mipsel | microblaze )
-			dynamic_loader="${base_libdir}/ld.so.1"
-			;;
-		powerpc64)
-			dynamic_loader="${base_libdir}/ld64.so.1"
-			;;
-		x86_64)
-			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
-			;;
-		i*86 )
-			dynamic_loader="${base_libdir}/ld-linux.so.2"
-			;;
-		arm )
-			dynamic_loader="${base_libdir}/ld-linux.so.3"
-			;;
-		* )
-			dynamic_loader="/unknown_dynamic_linker"
-			;;
-	esac
+	# Set $dynamic_loader 
+        linuxloader
 
 	mklibs -v \
 		--ldlib ${dynamic_loader} \
diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass
index 53c4b0b..3fe097b 100644
--- a/meta/classes/image-prelink.bbclass
+++ b/meta/classes/image-prelink.bbclass
@@ -6,6 +6,8 @@ python prelink_setup () {
     oe.utils.write_ld_so_conf(d)
 }
 
+inherit linuxloader
+
 prelink_image () {
 #	export PSEUDO_DEBUG=4
 #	/bin/env | /bin/grep PSEUDO
@@ -31,8 +33,11 @@ prelink_image () {
 	fi
 	cat ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf >> $ldsoconf
 
+	# Set $dynamic_loader
+	linuxloader
+
 	# prelink!
-	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf
+	${STAGING_DIR_NATIVE}${sbindir_native}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
 
 	# Remove the prelink.conf if we had to add it.
 	if [ "$dummy_prelink_conf" = "true" ]; then
diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
new file mode 100644
index 0000000..af649cc
--- /dev/null
+++ b/meta/classes/linuxloader.bbclass
@@ -0,0 +1,23 @@
+
+linuxloader () {
+	case ${TARGET_ARCH} in
+		powerpc | mips | mipsel | microblaze )
+			dynamic_loader="${base_libdir}/ld.so.1"
+			;;
+		powerpc64)
+			dynamic_loader="${base_libdir}/ld64.so.1"
+			;;
+		x86_64)
+			dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
+			;;
+		i*86 )
+			dynamic_loader="${base_libdir}/ld-linux.so.2"
+			;;
+		arm )
+			dynamic_loader="${base_libdir}/ld-linux.so.3"
+			;;
+		* )
+			dynamic_loader="/unknown_dynamic_linker"
+			;;
+	esac
+}




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

end of thread, other threads:[~2016-03-04 22:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 13:27 [PATCH] linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking Richard Purdie
2015-09-29 17:09 ` Khem Raj
2016-03-04 17:23   ` Christopher Larson
2016-03-04 22:09     ` Dan McGregor
2016-03-04 16:28 Richard Purdie
2016-03-04 22:26 ` Khem Raj

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.