-
Notifications
You must be signed in to change notification settings - Fork 3
/
lfs-5.7-lfs.sh
executable file
·95 lines (74 loc) · 3.02 KB
/
lfs-5.7-lfs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
echo ""
echo '### 5.7. Glibc-2.22 (4.5 SBU)'
echo '### ================================================'
if [ ! -f ./lfs-include.sh ];then
echo "*** Fatal Error - './lfs-include.sh' not found." ; exit 8 ; fi
source ./lfs-include.sh
LFS_SECTION=5.7
LFS_SOURCE_FILE_PREFIX=glibc
LFS_BUILD_DIRECTORY=glibc-build # Leave empty if not needed
LFS_LOG_FILE=$LFS_MOUNT_DIR/build-logs/$LFS_SECTION-$LFS_SOURCE_FILE_PREFIX
echo "*** Validating the environment."
check_user lfs
check_lfs_partition_mounted_and_swap_on
########## Extract Source and Change Directory ##########
cd $LFS_MOUNT_DIR/sources
test_only_one_tarball_exists
extract_tarball $LFS_MOUNT_DIR
cd $(ls -d $LFS_MOUNT_DIR/sources/$LFS_SOURCE_FILE_PREFIX*/)
########## Begin LFS Chapter Content ##########
time {
echo "*** Running Pre-Configuration Tasks ... $LFS_SOURCE_FILE_NAME"
### Test to see if RPC headers are on host system and install if they are not
patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch &> $LFS_LOG_FILE-patch.log
mkdir ../$LFS_BUILD_DIRECTORY
cd ../$LFS_BUILD_DIRECTORY
echo "*** Running Configure ... $LFS_SOURCE_FILE_NAME"
../glibc-2.22/configure \
--prefix=/tools \
--host=$LFS_TGT \
--build=$(../glibc-2.22/scripts/config.guess) \
--disable-profile \
--enable-kernel=2.6.32 \
--enable-obsolete-rpc \
--with-headers=/tools/include \
libc_cv_forced_unwind=yes \
libc_cv_ctors_header=yes \
libc_cv_c_cleanup=yes \
&> $LFS_LOG_FILE-configure.log
echo "*** Running Make ... $LFS_SOURCE_FILE_NAME"
make $LFS_MAKE_FLAGS \
&> $LFS_LOG_FILE-make.log
echo "*** Running Make Install ... $LFS_SOURCE_FILE_NAME"
make install $LFS_MAKE_FLAGS \
&> $LFS_LOG_FILE-make-install.log
echo "*** Performing Post-Make Tasks ... $LFS_SOURCE_FILE_NAME"
### None
}
########## Chapter Clean-Up ##########
echo ""
echo "*** Cleaning Up ... $LFS_SOURCE_FILE_NAME"
cd $LFS_MOUNT_DIR/sources
[ ! $LFS_DO_NOT_DELETE_SOURCES_DIRECTORY ] && rm -rf $(ls -d $LFS_MOUNT_DIR/sources/$LFS_SOURCE_FILE_PREFIX*/)
rm -rf $LFS_BUILD_DIRECTORY
echo ""
echo "*** Note: May include 'error' entries that are actually part of an echo statement"
show_build_errors $LFS_MOUNT_DIR
echo ""
echo "************ STOP!!!!!!! ************"
echo "*** Verify the toolchain is working!! ***"
echo "*** Output should have no errors, and the two lines below should be the same."
echo "*** [Requesting program interpreter: /tools/lib/ld-linux.so.2] for 32bit"
echo "*** [Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2] for 64bit"
echo 'int main(){}' > dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'
### Note: I've moved 'rm -v dummy.c a.out' to 5.8
capture_file_list $LFS_MOUNT_DIR
chapter_footer
if [ $LFS_ERROR_COUNT -ne 0 ]; then
exit 4
else
exit
fi