Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Compiling kernel from another pc can I use it to my pc?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Mon Jan 02, 2017 3:15 pm    Post subject: Compiling kernel from another pc can I use it to my pc? Reply with quote

There is a pc with intel core i5 32 bit linux system. I've compiled kernel 4.7 there. Can I use this compiled kernel to my home pc. Home computer has also 32 bit same linux operating system.
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2288
Location: near Augsburg, Germany

PostPosted: Tue Jan 03, 2017 10:15 am    Post subject: Reply with quote

How is the kernel configured and compiled?

When the hardware of both machines is the same, the kernel can be transferred.
Back to top
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Tue Jan 03, 2017 1:05 pm    Post subject: Reply with quote

Keruskerfuerst wrote:
How is the kernel configured and compiled?

When the hardware of both machines is the same, the kernel can be transferred.

cd linux-4.7.2
make menuconfig
make -j2

Compiled with intel core i5 3.3 GHz. I want to copy linux-4.7.2 to home pc. Home pc has intel pentium D 2.66GHz. Both have same linux operating system.


Last edited by colag on Tue Jan 03, 2017 1:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Tue Jan 03, 2017 1:28 pm    Post subject: Reply with quote

colag,

You must make a kernel that has all the drivers for both systems.
e.g. if one system has a realtec network card and the other an intel card, you need both drivers.
Its the same for all the hardware.

You need to transfer the kernel file, initrd file, if you use one and the modules directory /lib/modules/<kernel-version>
Its useful to copy /usr/src/<kernel-version>/[.config Makefile] too as some build systems refer to these files.
Typically, the build won't fail, you will just get warnings about kernel checks failing.
If you can live with the warnings, these files are not required.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Tue Jan 03, 2017 1:50 pm    Post subject: Reply with quote

NeddySeagoon wrote:
colag,

You must make a kernel that has all the drivers for both systems.
e.g. if one system has a realtec network card and the other an intel card, you need both drivers.
Its the same for all the hardware.

You need to transfer the kernel file, initrd file, if you use one and the modules directory /lib/modules/<kernel-version>
Its useful to copy /usr/src/<kernel-version>/[.config Makefile] too as some build systems refer to these files.
Typically, the build won't fail, you will just get warnings about kernel checks failing.
If you can live with the warnings, these files are not required.

I will run the kernel at home only. So I selected/checked only those drivers I need for home use. Will it work? Why do I need to check/select drivers of the pc with intel core i5?
Does make -j2 create initrd file? And make modules_install should copy modules in /lib/modules/<kernel-version>
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Tue Jan 03, 2017 2:01 pm    Post subject: Reply with quote

colag,

make -j2 does not make the initrd file. If you configure the kernel with everything for booting set to <*> then no initrd is needed.
If you will only use the kernel at home, it need only support that hardware.
Reading you post, I read that you wanted to use it on both systems.

There is a small trap. /lib/modules/<kernel-version> will be overwritten if it exists.
You can avoid that with
Code:
make modules_install INSTALL_MOD_PATH=/mnt/floppy
or whatever alternate path you want.
It might be a very bad thing to overwrite your work /lib/modules/<kernel-version> with your home one.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Tue Jan 03, 2017 2:33 pm    Post subject: Reply with quote

@NeddySeagoon,

I will not use this linux-4.7.2 in that pc with intel core i5 3.3 GHz. I will use it only at home. It's compiled with drivers and necessary modules or other options for home pc. I will copy linux-4.7.2 in my home pc, delete /lib/modules/<kernel-version>. Then

make modules_install
cp arch/x86/boot/bzImage /boot/vmlinuz-4.7.2
cp System.map /boot/System.map-4.7.2
cp .config /boot/config-4.7.2

Will it work?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Tue Jan 03, 2017 3:03 pm    Post subject: Reply with quote

colag,

To run make modules_install at home, you need the entire kernel tree.
I had in mind you would only take home the pieces that you need.

What you say will work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum