linux kernel crosscompile: x86_64 gepen ix86os kernelt

Fórumok

Udv mindenkinek. Eddig egy PIVDualos gepen gond nelkul keszitettem kernelt tobb pentium sorozatu gepekre, valamint 64bites opteronra is, debian etch (amd64) oprendszer alatt. Azonban most ugyanezt a feladatot egy Core2Dual -os gepen szeretnem elvegezni, ujrainstalltam a debian etch-et, ugyanugy amd64-es valtozattal, azonabn ezzel mar nem tudok i386os kernelt forditani, nem ajanlja fel a menuconfig... probalkoztam olyannal, h "make ARCH=i386" ami ugy tunt mukodik is, de aztan a forditas mindenfele hibaval elszallt:
arch/i386/kernel/asm-offsets.c:106: error: invalid use of undefined type âstruct i386_pdaâ
arch/i386/kernel/asm-offsets.c:107: error: invalid use of undefined type âstruct i386_pdaâ
make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
sh /sources/kernel/src/linux-2.6.20-ovz-grsec/arch/i386/boot/install.sh 2.6.20-ovz007-grsec arch/i386/boot/bzImage System.map "/sources/kernel/targets/pen.eiszproxy"

ezutan elkezdtem keresgelni a neten, hogy pontosan hogy is kell ezt csinalni, talaltam egy CROSSTOOL nevu eszkozt, amivel sikeresen elkeszitettem a 32bites gcct meg a libeket, csak az a gond h hasznalni nem tudom :). netes forrasok szerint a kovetkezonek kellene mukodnie:
cd ./src/linux
make menuconfig ARCH=i386 CROSS_COMPILE=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-
make ARCH=i386 CROSS_COMPILE=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-
make install ARCH=i386 CROSS_COMPILE=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-

De
/bin/sh: /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc: Permission denied
make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

ezt a hibat kapom. a fileon minden jog megvan, a jelenlegi 64es kernelben van 32bites emu, es ha csak siman megprobalom elinditani a "i686-unknown-linux-gnu-gcc" -t, ami ugye a 32bites gcc lenne, akkor is permission denied. strace-tol sem lettem boldogabb:

compiler:/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin# strace ./i686-unknown-linux-gnu-gcc
execve("./i686-unknown-linux-gnu-gcc", ["./i686-unknown-linux-gnu-gcc"], [/* 22 vars */]) = -1 EACCES (Permission denied)
dup(2) = 4
fcntl(4, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x341a25ea0000
lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(4, "strace: exec: Permission denied\n", 32strace: exec: Permission denied
) = 32
close(4) = 0
munmap(0x341a25ea0000, 4096) = 0
brk(0x571000) = 0x571000
exit_group(1) = ?
Process 14158 detached

van egy lyan erzesem, h ezen az uton nem fogok elorebb jutni. Tehat csinallt mar valaki ilyesmit, es ha igen, le tudna irni nekem egy gyorstalpalon, h mikent forditsam le azt a nyavajas kernelt 64bites renceren i386-ra (vagy akar sparc-ra)?

Köszönöm!

Hozzászólások

Anno a slackware azert valtot i386 csomagokrol i486-ra, mert az akkori uj GCC-k (azaz a maiak sem) mar nem tamogattak a regi i386-only kod forgatasat.

Bar szerintem itt keverodnek a dolgok, ugyanis sokszor i386nak hivjuk az osszes x86-ot is :)

az /opt nem kulon fs-en van? esetleg noexec-el mountoltad?

hű, hogy ez előbb nem jutott eszembe! Tényleg... Meg is örültem, kipróbáltam. Most már úgy néz ki fut aminek kell, de a hibaüzenet ugyanaz:

*** Execute 'make' to build the kernel or try 'make help'.

scripts/kconfig/conf -s arch/i386/Kconfig
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CC arch/i386/kernel/asm-offsets.s
In file included from include/linux/kobject.h:25,
from include/linux/module.h:17,
from include/linux/crypto.h:21,
from arch/i386/kernel/asm-offsets.c:7:
include/linux/rwsem.h:24:65: error: asm/rwsem.h: No such file or directory
In file included from include/linux/module.h:17,
from include/linux/crypto.h:21,
from arch/i386/kernel/asm-offsets.c:7:
include/linux/kobject.h:178: error: field 'rwsem' has incomplete type
....
arch/i386/kernel/asm-offsets.c:80: error: 'struct pt_regs' has no member named 'xcs'
arch/i386/kernel/asm-offsets.c:82: error: 'struct pt_regs' has no member named 'esp'
arch/i386/kernel/asm-offsets.c:83: error: 'struct pt_regs' has no member named 'xss'
arch/i386/kernel/asm-offsets.c:95: error: 'struct tss_struct' has no member named 'esp0'
arch/i386/kernel/asm-offsets.c:100: error: 'VDSO_PRELINK' undeclared (first use in this function)
arch/i386/kernel/asm-offsets.c:100: error: (Each undeclared identifier is reported only once
arch/i386/kernel/asm-offsets.c:100: error: for each function it appears in.)
arch/i386/kernel/asm-offsets.c:105: error: '__cpu_pda' undeclared (first use in this function)
arch/i386/kernel/asm-offsets.c:106: error: invalid use of undefined type 'struct i386_pda'
arch/i386/kernel/asm-offsets.c:107: error: invalid use of undefined type 'struct i386_pda'
make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
sh /sources/kernel/src/linux-2.6.21.6-grsec/arch/i386/boot/install.sh 2.6.21.6-grsec arch/i386/boot/bzImage System.map "/boot"

Szia!

Nálad valszeg az a gond, hogy a gcc-d csak x64 kódot tud!
Crosscompile cucc kell hozzá.

itt nézelődj vagy itt

Üdv Zsirmo

ami egyébként külön jó, hogy ugynaezen a gépen van openvz környezet. csináltam egy virtuális gépet i386-os tmeplate-el, és azon belül próbáltam meg a fordítást (etch-i386 volt az alaptemplate, a csomagok mind i386...) de úgy is ugyanezt a hibát kaptam, frissen letöltött kernellel, szal még azt sem mondhatom h a patchek nem szeretik az i386ot és csak 64bit alatt működnek (mondjuk ez inkább fordítva szokott lenni.).

i386-os dev file-ok bent vannak a /usr/include könyvtárban?

Nekem mindig igazam van, ha nem, akkor nincs igazam, szoval megint igazam van hogy nincs igazam.

debian 4.0 - linux-2.6.22-pancs1-wifi0 - 2.6.22 kernel madwifivel itt

hat a buildroot "Don't know how to support your architecture" beszolassal kb 2 oranyi iteracio utan leallt.

/usr/include -on belul van olyanom, h

asm-i386, meg i486-linux-gnu

tehat feltetelezem h fent van. Amugy felraktam minden 32bites libet amit talaltam az amd64es etchben mar kinomban, ugyhogy van /emul es /lib32 konyvtaram is mostmar...