[PATCH] linker, rechter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Where commit c501b339a2a2d4f5f732655dde7eddc41c030ad7 tried to correct the location of the linker library in the boot image, but it only checked for ld-linux.so.2, not ld-linux-x86_64.so.2

with this patch, I try to fix that by testing if there is such a thing as ld-linux.so.2 or ld-linux-x86_64.so.2 in $LIBDIR, and then only continuing if both of these are not links (to what is now ld-2.9.so) already.

Needless to say, these checks get executed for every instbin() call, so like a thousand times, and the next logical step would be to make that happen only once or twice.

The problem I encountered was that ld-linux.so.2 turned out to be linked to ld-linux.so.2 itself. The check on whether ld-linux.so.2 is already a symlink fixes that problem, but the problem didn't arise on x86_64 to being with (since there is no ld-linux.so.2 in /lib64/).

These are the only two arches I've been able to fix this for, but I can say that ppc/ppc64 does not have /lib{,64}/ld-linux*.so* files to begin with.

(I should note that removing the patch in commit c501b339a2a2d4f5f732655dde7eddc41c030ad7 also solved my original problem)

Also available as commit ce4eb694f2dee9701005ccee9edfb66358aa8c81 from remote git://git.kanarip.com/anaconda

Please apply to master and f10-branch, if applied at all.

Kind regards,

Jeroen van Meeuwen
-kanarip
>From ce4eb694f2dee9701005ccee9edfb66358aa8c81 Mon Sep 17 00:00:00 2001
From: Jeroen van Meeuwen (Fedora Unity) <kanarip@xxxxxxxxxxxxxxx>
Date: Fri, 30 Jan 2009 07:51:12 +0100
Subject: [PATCH] Make it so ld-linux.so.2 and ld-linux-x86_64.so.2 are only removed when
     they are not actually links

---
 scripts/mk-images |   50 ++++++++++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/scripts/mk-images b/scripts/mk-images
index 6ab52ce..d570990 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -134,14 +134,14 @@ INITRDMODS="$USBMODS $FIREWIREMODS $IDEMODS $SCSIMODS $FSMODS $LVMMODS $RAIDMODS
     else
 	KERNELDIR="/boot"
     fi
-    
+
     if [ "$BUILDARCH" = "sparc64" ]; then
 	BASEARCH=sparc
     else
 	BASEARCH=$BUILDARCH
     fi
 
-    # explicit block size setting for some arches (FIXME: we compose 
+    # explicit block size setting for some arches (FIXME: we compose
     # ppc64-ish trees as ppc, so we have to set the "wrong" block size)
     if [ "$BUILDARCH" = "sparc64" ]; then
 	CRAMBS="--blocksize 8192"
@@ -218,7 +218,7 @@ INITRDMODS="$USBMODS $FIREWIREMODS $IDEMODS $SCSIMODS $FSMODS $LVMMODS $RAIDMODS
 	   fi
        fi
     fi
- 
+
 findPackage() {
     name=$1
 
@@ -340,7 +340,7 @@ makemoduletree() {
     rundepmod $MMB_DIR
     rm -f $MMB_DIR/lib/modules/*/modules.*map
     rm -f $MMB_DIR/lib/modules/*/{build,source}
-    
+
     # create the pci.ids, from modules.alias and the X driver aliases
     awk '!/^(\t\t|#)/ { print ;if ($0 == "ffff  Illegal Vendor ID") nextfile; }' < $PCIIDS | \
       $TRIMPCIIDS $MMB_DIR/lib/modules/*/modules.alias $XDRIVERS/* > ../pci.ids
@@ -374,19 +374,21 @@ instbin() {
     done
 
     pushd $DIR/$LIBDIR
-    if [ -f ld-linux.so.2 ]; then
-        rm -f ld-linux.so.2
-        linker="$(ls -1 ld-*.*.*.so)"
-        if [ -z "$linker" ]; then
-            linker="$(ls -1 ld-*.*.so)"
+    if [ -f ld-linux.so.2 -o -f ld-linux-x86_64.so.2 ]; then
+        if [ ! -L ld-linux.so.2 -a ! -L ld-linux-x86_64.so.2 ]; then
+            rm -f ld-linux.so.2
+            linker="$(ls -1 ld-*.*.*.so)"
+            if [ -z "$linker" ]; then
+                linker="$(ls -1 ld-*.*.so)"
+            fi
+            found=$(echo $linker | wc -l)
+            if [ $found -ne 1 ]; then
+                echo "Found too many dynamic linkers:" >&2
+                echo $linker >&2
+                exit 1
+            fi
+            ln -s $linker ld-linux.so.2
         fi
-        found=$(echo $linker | wc -l)
-        if [ $found -ne 1 ]; then
-            echo "Found too many dynamic linkers:" >&2
-            echo $linker >&2
-            exit 1
-        fi
-        ln -s $linker ld-linux.so.2
     fi
     popd
 }
@@ -398,7 +400,7 @@ setupShellEnvironment() {
     for i in pam_limits.so pam_env.so pam_unix.so pam_deny.so; do
        cp -f $IMGPATH/$LIBDIR/security/$i $MBD_DIR/$LIBDIR/security
     done
-    
+
     cp -f $IMGPATH/etc/pam.d/other $MBD_DIR/etc/pam.d
     cat > $MBD_DIR/etc/pam.d/login << EOF
 #%PAM-1.0
@@ -461,7 +463,7 @@ EOF
     instbin $IMGPATH /usr/bin/login $MBD_DIR /sbin/login
     instbin $IMGPATH /usr/sbin/sshd $MBD_DIR /sbin/sshd
     instbin $IMGPATH /usr/bin/busybox $MBD_DIR /sbin/busybox
-    
+
     # make some symlinks
     (cd $MBD_DIR/sbin;
     	set $(./busybox 2>&1| awk '/^\t([[:alnum:]_\.\[]+,)+/' | sed 's/,//g' | sed 's/ +//');
@@ -788,7 +790,7 @@ makeinstimage () {
     (cd $IMGPATH; find . | cpio --quiet -p $tmp)
     makeproductfile $tmp
 
-    if [ -z "$type" -o "$type" = "cramfs" ]; then 
+    if [ -z "$type" -o "$type" = "cramfs" ]; then
         echo "Running mkcramfs $CRAMBS $tmp $INSTIMGPATH/${imagename}2.img"
         mkfs.cramfs $CRAMBS $tmp $TMPDIR/${imagename}2.img.$$
     elif [ "$type" = "squashfs" ]; then
@@ -810,7 +812,7 @@ makemainimage () {
     type=$2
     mmi_tmpimage=$TMPDIR/instimage.img.$$
     mmi_mntpoint=$TMPDIR/instimage.mnt.$$
-    
+
     rm -rf $mmi_tmpimage $mmi_mntpoint
     mkdir $mmi_mntpoint
 
@@ -825,7 +827,7 @@ makemainimage () {
 	    SIZE=$(expr $SIZE - $ERROR)
         fi
         dd if=/dev/zero bs=1k count=${SIZE} of=$mmi_tmpimage 2>/dev/null
-        mke2fs -q -F $mmi_tmpimage > /dev/null 
+        mke2fs -q -F $mmi_tmpimage > /dev/null
         tune2fs -c0 -i0 $mmi_tmpimage >/dev/null
         mount -o loop $mmi_tmpimage $mmi_mntpoint
 
@@ -848,14 +850,14 @@ makemainimage () {
         mkfs.cramfs $CRAMBS $IMGPATH $mmi_tmpimage
         SIZE=$(expr `cat $mmi_tmpimage | wc -c` / 1024)
     fi
-    
+
     cp $mmi_tmpimage $INSTIMGPATH/${imagename}.img
     chmod 644 $INSTIMGPATH/${imagename}.img
 
     echo "Wrote $INSTIMGPATH/${imagename}.img (${SIZE}k)"
     relpath=${INSTIMGPATH#$TOPDESTPATH/}
     echo "mainimage = ${relpath}/${imagename}.img" >> $TOPDESTPATH/.treeinfo
-    
+
     rm $mmi_tmpimage
 }
 
@@ -883,7 +885,7 @@ if [ ${BUILDARCH} = s390x ]; then
     source $TOPDIR/mk-images.s390
 elif [ ${BUILDARCH} = ppc64 ]; then
     # ... and similar for ppc64
-    source $TOPDIR/mk-images.ppc 
+    source $TOPDIR/mk-images.ppc
 elif [ ${BUILDARCH} = "x86_64" -o ${BUILDARCH} = "i386" ]; then
     source $TOPDIR/mk-images.x86
     source $TOPDIR/mk-images.efi
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux