Error kompile kernel TSL 2.1/TSL 2.2

Kasus yang ditemui pada waktu kompile kernel TSL 2.1 dan 2.2 adalah munculnya pesan error pada waktu melakukan perintah make.
Hal ini disebabkan compiler GCC pada TSL mensyaratkan opsi proteksi stact dihidupkan (tidak seperti pada distro lain yang dimatikan )

Pesan error yang muncul adalah

net/network.o(.text+0x47082): In function `packet_setsockopt':
: undefined reference to `__guard'
net/network.o(.text+0x4709e): In function `packet_setsockopt':
: undefined reference to `__stack_smash_handler'
net/network.o(.text.init+0x855): In function `inet_initpeers':
: undefined reference to `__guard'
net/network.o(.text.init+0x8f9): In function `inet_initpeers':
: undefined reference to `__guard'
net/network.o(.text.init+0x90f): In function `inet_initpeers':
: undefined reference to `__stack_smash_handler'
/usr/src/linux-2.4.28/lib/lib.a(vsprintf.o)(.text+0x2c8): In function `number':
: undefined reference to `__guard'
/usr/src/linux-2.4.28/lib/lib.a(vsprintf.o)(.text+0x4f3): In function `number':
: undefined reference to `__guard'
/usr/src/linux-2.4.28/lib/lib.a(vsprintf.o)(.text+0x513): In function `number':
: undefined reference to `__stack_smash_handler'
make: *** [vmlinux] Error 1

Solusi 1

Untuk mengatasi hal ini maka opsi stack protektor harus pasangkan pada kernel sebelum dikompile.
Cara yang paling mudah dengan mengedit file Makefile pada source kernel.
Misal pada kernel 2.4.28 :

root@azzura src# ls -al
total 66020
drwxr-xr-x   5 root root      216 Jan 17 09:59 ./
drwxr-xr-x  13 root root      288 Jan 16 14:36 ../
drwxr-xr-x  15 adi  users      840 Feb  6 14:53 linux-2.4.28/
-rw-r--r--   1 root root 31064046 Nov 17 119:54 linux-2.4.28.tar.bz2
drwxr-xr-x   7 root root      168 Jan 16 20:57 trustix/

root@azzura src# cd linux-2.4.28/
root@azzura linux-2.4.28# vi Makefile
Cari opsi CFLAGS pada file tersebut (sekitar baris 90) lalu tambahkan -fno-stack-protector :
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
          -fno-strict-aliasing -fno-common
menjadi
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
          -fno-strict-aliasing -fno-common -fno-stack-protector
Setelah ini kernel siap dikonfigurasi dan dikompile seperti prosedure yang berlaku.

Hal ini juga berlaku untuk mengatasi error serupa pada kernel 2.6.x

Solusi 2

Setelah selesai melakukan konfigurasi maka pada saat melakukan perintah make dapat ditambahkan perintah sebagai berikut :

kernel 2.4.x
# make 'CC=gcc -fno-stack-protector' dep
# make 'CC=gcc -fno-stack-protector' bzImage 'MAKE=make -j 1'
kernel 2.6.x
# make 'CC=gcc -fno-stack-protector' all 'MAKE=make -j 1'
make -j 1 menunjukkan jumlah processor yang dipakai ber-jumlah 1.

update


kembali ke [ daftar ] dokumentasi lainnya

Hosted by www.Geocities.ws

1