○ glibcの設定 4 Xen

・make はメンテナンスマシンで行っています


・ログイン端末で "#" はroot、"$" は一般ユーザのプロンプトの記号です
・設定ファイルで "#" で始まる行はコメントとして解釈されます


:glibc-2.5-58.el5_6.2.src.rpm (http://ftp.riken.jp/Linux/centos/)


最初の設定 (Xen)


:OS CentOS 5.6
:selinux disabled
:kernel kernel-2.6.18-238.9.1.el5
:glibc glibc-2.5-58.el5_6.2
:作業 /usr/src
:言語 LANG=en_US.UTF-8
:ユーザー rootで実行




  ** WARNING: Currently emulating unsupported memory accesses  **
  **          in /lib/tls glibc libraries. The emulation is    **
  **          slow. To ensure full performance you should      **
  **          install a 'xen-friendly' (nosegneg) version of   **
  **          the library, or disable tls support by executing **
  **          the following as root:                           **
  **          mv /lib/tls /lib/tls.disabled                    **
  ** Offending process: iconvconfig.i68 (pid=1256)             **




 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
 * Here we can supply some information useful to userland.
 * First we get the vanilla i386 note that supplies the kernel version info.

#include "vsyscall-note.S"

 * Now we add a special note telling glibc's dynamic linker a fake hardware
 * flavor that it will use to choose the search path for libraries in the
 * same way it uses real hardware capabilities like "mmx".
 * We supply "nosegneg" as the fake capability, to indicate that we
 * do not like negative offsets in instructions using segment overrides,
 * since we implement those inefficiently. This makes it possible to
 * install libraries optimized to avoid those access patterns in someplace
 * like /lib/i686/tls/nosegneg. Note that an /etc/ld.so.conf.d/file
 * corresponding to the bits here is needed to make ldconfig work right.
 * It should contain:
 * hwcap 0 nosegneg
 * to match the mapping of bit to name that we give here.
#define NOTE_KERNELCAP_BEGIN(ncaps, mask) \
 ASM_ELF_NOTE_BEGIN(".note.kernelcap", "a", "GNU", 2) \
 .long ncaps, mask
#define NOTE_KERNELCAP(bit, name) \
 .byte bit; .asciz name

NOTE_KERNELCAP(0, "nosegneg")


# echo 'hwcap 0 nosegneg' > /etc/ld.so.conf.d/xen-glibc.conf
# ldconfig


# ldd /usr/local/apache2/bin/httpd
    linux-gate.so.1 =>  (0xb7f8d000)
    libm.so.6 => /lib/i686/nosegneg/libm.so.6 (0xb7f5a000)
    libpcre.so.0 => /lib/libpcre.so.0 (0x4c9c0000)
    libaprutil-1.so.0 => /usr/local/apache2/lib/libaprutil-1.so.0 (0xb7f3e000)
    libexpat.so.0 => /lib/libexpat.so.0 (0x4c970000)
    libapr-1.so.0 => /usr/local/apache2/lib/libapr-1.so.0 (0xb7f17000)
    libuuid.so.1 => /lib/libuuid.so.1 (0x4c4d6000)
    librt.so.1 => /lib/i686/nosegneg/librt.so.1 (0xb7f0d000)
    libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7edb000)
    libpthread.so.0 => /lib/i686/nosegneg/libpthread.so.0 (0xb7ec1000)
    libdl.so.2 => /lib/libdl.so.2 (0xb7ebc000)
    libc.so.6 => /lib/i686/nosegneg/libc.so.6 (0xb7d60000)
    /lib/ld-linux.so.2 (0xb7f8e000)



○System clockの設定

・"system clock"で UTC を使うように設定します





# useradd mockbuild
# cd /usr/src
# mkdir glibc
# rpm -ivh glibc-2.5-58.el5_6.2.src.rpm
# cd redhat/SPECS

・glibc.specファイルの修正 (下記)

# vi glibc.spec

# rpmbuild -bb --target i686 --clean --rmsource \
--define 'dist .el5_6' glibc.spec


# mv glibc.spec /usr/src/glibc
# cd ../RPMS/i686


# mv *.rpm /usr/src/glibc


# cd /usr/src/glibc
# rpm -Uvh --force glibc-2.5-58.el5_6.2.i686.rpm
# userdel -r mockbuild


# rpmbuild -bb --define 'dist .el5_6' glibc.spec




%ifarch %{ix86}
BuildFlags="-march=%{_target_cpu} -mtune=generic -mno-tls-direct-seg-refs"
%ifarch i686
BuildFlags="-march=i686 -mtune=generic -mno-tls-direct-seg-refs"
%ifarch i386
BuildFlags="$BuildFlags -mno-tls-direct-seg-refs"


○ Copyright(c) 528p.com All Rights Reserved.