Compiling kernel (i386) using make-kpkg

View: New views
13 Messages — Rating Filter:   Alert me  

Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am using Lenny (amd64) on my AMD Athlon(tm) 64 X2 Dual Core Processor "host" machine. Here is the arch info for this machine:
debian64:~# dpkg-architecture
DEB_BUILD_ARCH=amd64
DEB_BUILD_ARCH_OS=linux
DEB_BUILD_ARCH_CPU=amd64
DEB_BUILD_GNU_CPU=x86_64
DEB_BUILD_GNU_SYSTEM=linux-gnu
DEB_BUILD_GNU_TYPE=x86_64-linux-gnu
DEB_HOST_ARCH=amd64
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=amd64
DEB_HOST_GNU_CPU=x86_64
DEB_HOST_GNU_SYSTEM=linux-gnu
DEB_HOST_GNU_TYPE=x86_64-linux-gnu
debian:/usr/src/

Now I would like to compile a 32-bit kernel (i386) for my Intel "target" machine on my above 64-bit host machine. Here is the architecture is for my target machine:
debian32:~# dpkg-architecture
DEB_BUILD_ARCH=i386
DEB_BUILD_ARCH_OS=linux
DEB_BUILD_ARCH_CPU=i386
DEB_BUILD_GNU_CPU=i486
DEB_BUILD_GNU_SYSTEM=linux-gnu
DEB_BUILD_GNU_TYPE=i486-linux-gnu
DEB_HOST_ARCH=i386
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=i386
DEB_HOST_GNU_CPU=i486
DEB_HOST_GNU_SYSTEM=linux-gnu
DEB_HOST_GNU_TYPE=i486-linux-gnu
debian32:~#

I would like to build kernels using make-kpkg i.e. Debian way. What is the best way to do this?

So far I have tried:
# linux32
# CROSS_COMPILE=i486-linux-gnu
fakeroot make-kpkg --cross-compile - -arch i386 --append-to-version=-32bit kernel_image

but it gives me the following error mesasge:
dpkg-gencontrol: error: current host architecture 'amd64' does not appear in package's architecture list (i386)

Somebody suggested me to use the compile flag "-m32" but I am not sure where to add this and how to tell make-kpkg to see it.

I would like to know if anybody in this list knows how to compile a 32-bit (i386) kernel on a 64-bit (amd64) OS. I am guessing it should not be that hard.

Regards,

Kushal Koolwal

I do blog at http://blogs.koolwal.net/



     
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ah yes..I know this can be done using a 32bit chroot. But I am wondering is this can be done without a chroot.

Kushal Koolwal

I do blog at http://blogs.koolwal.net/


     
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Goswin von Brederlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kushal Koolwal <kushalkoolwal@...> writes:

> Ah yes..I know this can be done using a 32bit chroot. But I am wondering is this can be done without a chroot.
>
> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/

or simply with

make-kpkg --cross-compile - --arch i386

MfG
        Goswin


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Goswin,

> make-kpkg --cross-compile - --arch i386
I tried the above command before posting to the list. It does not work on my system. I think I got an error at the very end of compile process. Can't seem to remember the error though.

Does the above command work for you?

Kushal Koolwal

I do blog at http://blogs.koolwal.net/
     
_________________________________________________________________
Bing brings you maps, menus, and reviews organized in one place.
http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Goswin von Brederlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kushal Koolwal <kushalkoolwal@...> writes:

> Hi Goswin,
>
>> make-kpkg --cross-compile - --arch i386
> I tried the above command before posting to the list. It does not work on my system. I think I got an error at the very end of compile process. Can't seem to remember the error though.
>
> Does the above command work for you?
>
> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/

I wrote the patch for make-kpkg for it. All I can say is that it used
to work. Been a while since I used it.

Do you have gcc-multilib installed? What error do you get?

MfG
        Goswin


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thank you for following up, Goswin.

>Do you have gcc-multilib installed?
Yes I do:
debian64# dpkg -l | grep multilib
ii  gcc-4.3-multilib                      4.3.2-1.1                   The GNU C compiler (multilib files)
ii  gcc-multilib                          4:4.3.2-2                   The GNU C compiler (multilib files)

Here is  gcc version:
# gcc --version
gcc (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)

>What error do you get?
So I tried it and it didn't give me an error but it created a 64-bit package. I gave the command:
debian64# make-kpkg --cross-compile - --arch i386 --append-to-version=-32bit kernel_image

and it created a package:

linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb

which upon installing gave the following error:
dpkg: error processing linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb (--install):
 package architecture (amd64) does not match system (i386)
Errors were encountered while processing:
 linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb
debian32:~#

However if I give the following command:
debian64# linux32
debian64# make-kpkg --cross-compile - --arch i386 --append-to-version=-32bit kernel_image
then it gives me the following error:

Any ideas?

Kushal Koolwal

I do blog at http://blogs.koolwal.net/


     
_________________________________________________________________
Bing brings you maps, menus, and reviews organized in one place.
http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Goswin von Brederlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kushal Koolwal <kushalkoolwal@...> writes:

> Thank you for following up, Goswin.
>
>>Do you have gcc-multilib installed?
> Yes I do:
> debian64# dpkg -l | grep multilib
> ii  gcc-4.3-multilib                      4.3.2-1.1                   The GNU C compiler (multilib files)
> ii  gcc-multilib                          4:4.3.2-2                   The GNU C compiler (multilib files)
>
> Here is  gcc version:
> # gcc --version
> gcc (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)
>
>>What error do you get?
> So I tried it and it didn't give me an error but it created a 64-bit package. I gave the command:
> debian64# make-kpkg --cross-compile - --arch i386 --append-to-version=-32bit kernel_image
>
> and it created a package:
>
> linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb
>
> which upon installing gave the following error:
> dpkg: error processing linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb (--install):
>  package architecture (amd64) does not match system (i386)
> Errors were encountered while processing:
>  linux-image-2.6.30-8-bpo50-32bit_2.6.30-8-bpo50-32bit-10.00.Custom_amd64.deb
> debian32:~#

If you unpack the deb with dpkg -x does it contain a 32bit kernel?

MfG
        Goswin


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> If you unpack the deb with dpkg -x does it contain a 32bit kernel?
So I unpacked it:
# dpkg -x <linux-image> ~/tmp

But I am not sure what to do after that? The above command unpacked files as if it would have unpacked into a standard directories ~/tmp/boot, ~/tmp/usr, ~/tmp/lib/

Kushal Koolwal

I do blog at http://blogs.koolwal.net/

     
_________________________________________________________________
Windows 7: I wanted simpler, now it's simpler. I'm a rock star.
http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009

--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Alex Samad :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 18, 2009 at 10:26:44AM -0800, Kushal Koolwal wrote:
>
> > If you unpack the deb with dpkg -x does it contain a 32bit kernel?
just wondering if it might not be simpler to create a 32 bit chroot or a
32b virtual machine to do this ?

Alex

> So I unpacked it:
> # dpkg -x <linux-image> ~/tmp
>
> But I am not sure what to do after that? The above command unpacked files as if it would have unpacked into a standard directories ~/tmp/boot, ~/tmp/usr, ~/tmp/lib/
>
> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/
>
>      
> _________________________________________________________________
> Windows 7: I wanted simpler, now it's simpler. I'm a rock star.
> http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009
>
--
"You see, not only did the attacks help accelerate a recession, the attacks reminded us that we are at war."

        - George W. Bush
06/08/2005
Washington, DC


signature.asc (205 bytes) Download Attachment

RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Alex,

> just wondering if it might not be simpler to create a 32 bit chroot or a
> 32b virtual machine to do this ?

Yes you are right and I am aware of this solution as mentioned in my earlier post in this thread. However I would like to know if it can also be done without a chroot/vm solution.

Kushal Koolwal

I do blog at http://blogs.koolwal.net/








     
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Goswin von Brederlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kushal Koolwal <kushalkoolwal@...> writes:

> Alex,
>
>> just wondering if it might not be simpler to create a 32 bit chroot or a
>> 32b virtual machine to do this ?
>
> Yes you are right and I am aware of this solution as mentioned in my earlier post in this thread. However I would like to know if it can also be done without a chroot/vm solution.
>
> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/

After talking to the maintainer of make-kpkg on irc it seems this is
expected behaviour. This behaviour allows to build a 32bit kernel for
installation on amd64 or (more importantly) to build a 64bit kernel
for installation on i386.

If you really want a 32bit kernel for i386 you can use a 32bit chroot
or symlink i486-linux-gnu-{gcc,as,objcopy,...} to the 64bit binaries
and do a "real" cross-compile.

You could also change the architecture of the produced binary with

deb-reversion -k "sed -i 's/Architecture: amd64/Architecture: i386/'" DEBIAN/control"

or

deb-reversion -k bash    and edit the control file yourself


MfG
        Goswin

PS: I just thought of one more thing. Try --cross-compile "".


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


RE: Compiling kernel (i386) using make-kpkg

by Kushal Koolwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> PS: I just thought of one more thing. Try --cross-compile "".
I did tried it and I got the following errors:

make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
make EXTRAVERSION=-32bit  CROSS_COMPILE=i486-linux-gnu- ARCH=i386 prepare
/usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 25: i486-linux-gnu-gcc: command not found
/usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 26: i486-linux-gnu-gcc: command not found
make[2]: i486-linux-gnu-gcc: Command not found
make[2]: Entering directory `/usr/src/linux-source-2.6.30'
scripts/kconfig/conf -s arch/x86/Kconfig
make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
/usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 25: i486-linux-gnu-gcc: command not found
/usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 26: i486-linux-gnu-gcc: command not found
make[2]: i486-linux-gnu-gcc: Command not found
make[2]: Entering directory `/usr/src/linux-source-2.6.30'
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/linux/utsrelease.h
  UPD     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
  CC      kernel/bounds.s
/bin/sh: i486-linux-gnu-gcc: command not found
make[3]: *** [kernel/bounds.s] Error 127
make[2]: *** [prepare0] Error 2
make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
make[1]: *** [debian/stamp/conf/kernel-conf] Error 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.30'
make: *** [debian/stamp/conf/minimal_debian] Error 2
Failed to create a ./debian directory: No such file or directory at /usr/bin/make-kpkg line 1048.

May be i should symlink i486-linux-gnu-gcc to x86_64-linux-gnu-gcc to make the above work?

Kushal Koolwal

I do blog at http://blogs.koolwal.net/
     
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Compiling kernel (i386) using make-kpkg

by Goswin von Brederlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kushal Koolwal <kushalkoolwal@...> writes:

>> PS: I just thought of one more thing. Try --cross-compile "".
> I did tried it and I got the following errors:
>
> make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
> make EXTRAVERSION=-32bit  CROSS_COMPILE=i486-linux-gnu- ARCH=i386 prepare
> /usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 25: i486-linux-gnu-gcc: command not found
> /usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 26: i486-linux-gnu-gcc: command not found
> make[2]: i486-linux-gnu-gcc: Command not found
> make[2]: Entering directory `/usr/src/linux-source-2.6.30'
> scripts/kconfig/conf -s arch/x86/Kconfig
> make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
> /usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 25: i486-linux-gnu-gcc: command not found
> /usr/src/linux-source-2.6.30/scripts/gcc-version.sh: line 26: i486-linux-gnu-gcc: command not found
> make[2]: i486-linux-gnu-gcc: Command not found
> make[2]: Entering directory `/usr/src/linux-source-2.6.30'
>   CHK     include/linux/version.h
>   UPD     include/linux/version.h
>   CHK     include/linux/utsrelease.h
>   UPD     include/linux/utsrelease.h
>   SYMLINK include/asm -> include/asm-x86
>   CC      kernel/bounds.s
> /bin/sh: i486-linux-gnu-gcc: command not found
> make[3]: *** [kernel/bounds.s] Error 127
> make[2]: *** [prepare0] Error 2
> make[2]: Leaving directory `/usr/src/linux-source-2.6.30'
> make[1]: *** [debian/stamp/conf/kernel-conf] Error 2
> make[1]: Leaving directory `/usr/src/linux-source-2.6.30'
> make: *** [debian/stamp/conf/minimal_debian] Error 2
> Failed to create a ./debian directory: No such file or directory at /usr/bin/make-kpkg line 1048.
>
> May be i should symlink i486-linux-gnu-gcc to x86_64-linux-gnu-gcc to make the above work?

Yes. But also as, objcopy and a few more I think. My hope was that ""
would make it skip the prefix.

> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/

MfG
        Goswin


--
To UNSUBSCRIBE, email to debian-amd64-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...