Compiling the kernel with default configurations
Assumptions:
The platform:
anisha@linux-dopx:~/> uname -aLinux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/LinuxThe kernel downloaded is the latest stable one from kernel.org.
- We let the defaults remain (make no changes) in the options of
make menuconfig. - Simply type
make,make install,grub-update, and reboot.
Now, following these assumptions, are we still required to make some additional changes to files or compile some extra drivers to ensure a error free reboot?
If yes, then on what things do those changes depend on?
EDIT 1:
anisha@linux-dopx:/> sudo /sbin/lspci -n
00:00.0 0600: 8086:29c0 (rev 10)
00:02.0 0300: 8086:29c2 (rev 10)
00:1b.0 0403: 8086:27d8 (rev 01)
00:1c.0 0604: 8086:27d0 (rev 01)
00:1c.1 0604: 8086:27d2 (rev 01)
00:1d.0 0c03: 8086:27c8 (rev 01)
00:1d.1 0c03: 8086:27c9 (rev 01)
00:1d.2 0c03: 8086:27ca (rev 01)
00:1d.3 0c03: 8086:27cb (rev 01)
00:1d.7 0c03: 8086:27cc (rev 01)
00:1e.0 0604: 8086:244e (rev e1)
00:1f.0 0601: 8086:27b8 (rev 01)
00:1f.1 0101: 8086:27df (rev 01)
00:1f.2 0101: 8086:27c0 (rev 01)
00:1f.3 0c05: 8086:27da (rev 01)
01:00.0 0200: 10ec:8136 (rev 01)
linux kernel compiling
add a comment |
Assumptions:
The platform:
anisha@linux-dopx:~/> uname -aLinux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/LinuxThe kernel downloaded is the latest stable one from kernel.org.
- We let the defaults remain (make no changes) in the options of
make menuconfig. - Simply type
make,make install,grub-update, and reboot.
Now, following these assumptions, are we still required to make some additional changes to files or compile some extra drivers to ensure a error free reboot?
If yes, then on what things do those changes depend on?
EDIT 1:
anisha@linux-dopx:/> sudo /sbin/lspci -n
00:00.0 0600: 8086:29c0 (rev 10)
00:02.0 0300: 8086:29c2 (rev 10)
00:1b.0 0403: 8086:27d8 (rev 01)
00:1c.0 0604: 8086:27d0 (rev 01)
00:1c.1 0604: 8086:27d2 (rev 01)
00:1d.0 0c03: 8086:27c8 (rev 01)
00:1d.1 0c03: 8086:27c9 (rev 01)
00:1d.2 0c03: 8086:27ca (rev 01)
00:1d.3 0c03: 8086:27cb (rev 01)
00:1d.7 0c03: 8086:27cc (rev 01)
00:1e.0 0604: 8086:244e (rev e1)
00:1f.0 0601: 8086:27b8 (rev 01)
00:1f.1 0101: 8086:27df (rev 01)
00:1f.2 0101: 8086:27c0 (rev 01)
00:1f.3 0c05: 8086:27da (rev 01)
01:00.0 0200: 10ec:8136 (rev 01)
linux kernel compiling
add a comment |
Assumptions:
The platform:
anisha@linux-dopx:~/> uname -aLinux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/LinuxThe kernel downloaded is the latest stable one from kernel.org.
- We let the defaults remain (make no changes) in the options of
make menuconfig. - Simply type
make,make install,grub-update, and reboot.
Now, following these assumptions, are we still required to make some additional changes to files or compile some extra drivers to ensure a error free reboot?
If yes, then on what things do those changes depend on?
EDIT 1:
anisha@linux-dopx:/> sudo /sbin/lspci -n
00:00.0 0600: 8086:29c0 (rev 10)
00:02.0 0300: 8086:29c2 (rev 10)
00:1b.0 0403: 8086:27d8 (rev 01)
00:1c.0 0604: 8086:27d0 (rev 01)
00:1c.1 0604: 8086:27d2 (rev 01)
00:1d.0 0c03: 8086:27c8 (rev 01)
00:1d.1 0c03: 8086:27c9 (rev 01)
00:1d.2 0c03: 8086:27ca (rev 01)
00:1d.3 0c03: 8086:27cb (rev 01)
00:1d.7 0c03: 8086:27cc (rev 01)
00:1e.0 0604: 8086:244e (rev e1)
00:1f.0 0601: 8086:27b8 (rev 01)
00:1f.1 0101: 8086:27df (rev 01)
00:1f.2 0101: 8086:27c0 (rev 01)
00:1f.3 0c05: 8086:27da (rev 01)
01:00.0 0200: 10ec:8136 (rev 01)
linux kernel compiling
Assumptions:
The platform:
anisha@linux-dopx:~/> uname -aLinux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/LinuxThe kernel downloaded is the latest stable one from kernel.org.
- We let the defaults remain (make no changes) in the options of
make menuconfig. - Simply type
make,make install,grub-update, and reboot.
Now, following these assumptions, are we still required to make some additional changes to files or compile some extra drivers to ensure a error free reboot?
If yes, then on what things do those changes depend on?
EDIT 1:
anisha@linux-dopx:/> sudo /sbin/lspci -n
00:00.0 0600: 8086:29c0 (rev 10)
00:02.0 0300: 8086:29c2 (rev 10)
00:1b.0 0403: 8086:27d8 (rev 01)
00:1c.0 0604: 8086:27d0 (rev 01)
00:1c.1 0604: 8086:27d2 (rev 01)
00:1d.0 0c03: 8086:27c8 (rev 01)
00:1d.1 0c03: 8086:27c9 (rev 01)
00:1d.2 0c03: 8086:27ca (rev 01)
00:1d.3 0c03: 8086:27cb (rev 01)
00:1d.7 0c03: 8086:27cc (rev 01)
00:1e.0 0604: 8086:244e (rev e1)
00:1f.0 0601: 8086:27b8 (rev 01)
00:1f.1 0101: 8086:27df (rev 01)
00:1f.2 0101: 8086:27c0 (rev 01)
00:1f.3 0c05: 8086:27da (rev 01)
01:00.0 0200: 10ec:8136 (rev 01)
linux kernel compiling
linux kernel compiling
edited Jan 19 '12 at 12:16
Aquarius_Girl
asked Jan 19 '12 at 10:27
Aquarius_GirlAquarius_Girl
64042141
64042141
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
It is not recommended just a bare make menuconfig. The required config depends on three things:
the hardware being used
the features used by the OS/distribution
the features by you (file-systems, raid, ..etc)
So the recommended "default" config in my view is:
cd your_kernel_src
cp /boot/your-distribution-config .config
make localmodconfig
make menuconfig
See also Kernel configuration for distributions. The first paragraph:
Configuring a kernel was once a fairly straightforward process, only
requiring knowledge of what hardware needs to be supported. Over time,
things have gotten more complex in general, but distributions have
added their own sets of dependencies on specific kernel
features—dependencies that can be difficult for regular users to
figure out. That led Linus Torvalds to put out an RFC proposal to add
distribution-specific kernel configuration options.
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a bookwriting linux driverswith the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?
– gideon
Dec 30 '16 at 11:14
add a comment |
Real hardware / distros will likely not work properly with defconfig
As mentioned on this answer, anything that is not given by the distribution or hardware vendor will very likely fail in subtle or less subtle ways, e.g.:
- you might not build driver support for some essential piece of hardware
- packages of the distribution might rely on a feature of the kernel that you did not build and fail
Furthermore, besides specific configs, it is normal for vendors to apply large patchsets on top of the vanilla kernel, even Ubuntu does this for example.
For Ubuntu / Debian in particular, I have described how to compile the supported kernel from source at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171 Modifying that stable kernel base is the sanest thing you can do in that case.
QEMU works with defconfig
One thing that defconfig does nicely though, it to boot on QEMU, tested on kernel v4.20, QEMU 2.12.
Here is a fully automated example with Buildroot.
As noted on that link, you need the following options to boot from disk:
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
although they are not needed for initrd.
For cross compilation to a different arch, e.g. aarch64, you need:
make ARCH=arm64 defconfig
But as explained here, although arm64 does boot on QEMU, it generates a super bloated kernel, and you likely want to roll out something more minimal e.g. as described here.
What make defconfig does exactly?
We can easily see which config file was used with a verbose build:
make V=1 defconfig
which outputs on v4.19:
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig defconfig
scripts/kconfig/conf --defconfig=arch/x86/configs/x86_64_defconfig Kconfig
from which we conclude that the used file must be arch/x86/configs/x86_64_defconfig.
See also: https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
make help also shows other interesting default related targets like alldefconfig and savedefconfig which may be useful.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f29439%2fcompiling-the-kernel-with-default-configurations%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It is not recommended just a bare make menuconfig. The required config depends on three things:
the hardware being used
the features used by the OS/distribution
the features by you (file-systems, raid, ..etc)
So the recommended "default" config in my view is:
cd your_kernel_src
cp /boot/your-distribution-config .config
make localmodconfig
make menuconfig
See also Kernel configuration for distributions. The first paragraph:
Configuring a kernel was once a fairly straightforward process, only
requiring knowledge of what hardware needs to be supported. Over time,
things have gotten more complex in general, but distributions have
added their own sets of dependencies on specific kernel
features—dependencies that can be difficult for regular users to
figure out. That led Linus Torvalds to put out an RFC proposal to add
distribution-specific kernel configuration options.
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a bookwriting linux driverswith the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?
– gideon
Dec 30 '16 at 11:14
add a comment |
It is not recommended just a bare make menuconfig. The required config depends on three things:
the hardware being used
the features used by the OS/distribution
the features by you (file-systems, raid, ..etc)
So the recommended "default" config in my view is:
cd your_kernel_src
cp /boot/your-distribution-config .config
make localmodconfig
make menuconfig
See also Kernel configuration for distributions. The first paragraph:
Configuring a kernel was once a fairly straightforward process, only
requiring knowledge of what hardware needs to be supported. Over time,
things have gotten more complex in general, but distributions have
added their own sets of dependencies on specific kernel
features—dependencies that can be difficult for regular users to
figure out. That led Linus Torvalds to put out an RFC proposal to add
distribution-specific kernel configuration options.
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a bookwriting linux driverswith the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?
– gideon
Dec 30 '16 at 11:14
add a comment |
It is not recommended just a bare make menuconfig. The required config depends on three things:
the hardware being used
the features used by the OS/distribution
the features by you (file-systems, raid, ..etc)
So the recommended "default" config in my view is:
cd your_kernel_src
cp /boot/your-distribution-config .config
make localmodconfig
make menuconfig
See also Kernel configuration for distributions. The first paragraph:
Configuring a kernel was once a fairly straightforward process, only
requiring knowledge of what hardware needs to be supported. Over time,
things have gotten more complex in general, but distributions have
added their own sets of dependencies on specific kernel
features—dependencies that can be difficult for regular users to
figure out. That led Linus Torvalds to put out an RFC proposal to add
distribution-specific kernel configuration options.
It is not recommended just a bare make menuconfig. The required config depends on three things:
the hardware being used
the features used by the OS/distribution
the features by you (file-systems, raid, ..etc)
So the recommended "default" config in my view is:
cd your_kernel_src
cp /boot/your-distribution-config .config
make localmodconfig
make menuconfig
See also Kernel configuration for distributions. The first paragraph:
Configuring a kernel was once a fairly straightforward process, only
requiring knowledge of what hardware needs to be supported. Over time,
things have gotten more complex in general, but distributions have
added their own sets of dependencies on specific kernel
features—dependencies that can be difficult for regular users to
figure out. That led Linus Torvalds to put out an RFC proposal to add
distribution-specific kernel configuration options.
answered Jul 31 '12 at 15:22
Lai JiangshanLai Jiangshan
28527
28527
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a bookwriting linux driverswith the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?
– gideon
Dec 30 '16 at 11:14
add a comment |
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a bookwriting linux driverswith the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?
– gideon
Dec 30 '16 at 11:14
1
1
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
To put this more succinctly: There's no working "default" or "just what Linus intended" kernel config. If you just download and compile without configuring anything it is expected that you end up with a broken and/or barely functional kernel.
– bahamat
Jul 31 '12 at 18:02
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
The default configuration is just that. It used to be whatever Linus was running at the time. Get the configuration for your distribution, and use that as a starting point.
– vonbrand
Jan 18 '13 at 1:04
thanks for the answer, I'm trying to follow a book
writing linux drivers with the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?– gideon
Dec 30 '16 at 11:14
thanks for the answer, I'm trying to follow a book
writing linux drivers with the 2.6 kernel. I My Fedora 24 config has many invalid values for the 2.6 kernel. Any suggestions on what config to use to get the 2.6 kernel installed?– gideon
Dec 30 '16 at 11:14
add a comment |
Real hardware / distros will likely not work properly with defconfig
As mentioned on this answer, anything that is not given by the distribution or hardware vendor will very likely fail in subtle or less subtle ways, e.g.:
- you might not build driver support for some essential piece of hardware
- packages of the distribution might rely on a feature of the kernel that you did not build and fail
Furthermore, besides specific configs, it is normal for vendors to apply large patchsets on top of the vanilla kernel, even Ubuntu does this for example.
For Ubuntu / Debian in particular, I have described how to compile the supported kernel from source at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171 Modifying that stable kernel base is the sanest thing you can do in that case.
QEMU works with defconfig
One thing that defconfig does nicely though, it to boot on QEMU, tested on kernel v4.20, QEMU 2.12.
Here is a fully automated example with Buildroot.
As noted on that link, you need the following options to boot from disk:
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
although they are not needed for initrd.
For cross compilation to a different arch, e.g. aarch64, you need:
make ARCH=arm64 defconfig
But as explained here, although arm64 does boot on QEMU, it generates a super bloated kernel, and you likely want to roll out something more minimal e.g. as described here.
What make defconfig does exactly?
We can easily see which config file was used with a verbose build:
make V=1 defconfig
which outputs on v4.19:
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig defconfig
scripts/kconfig/conf --defconfig=arch/x86/configs/x86_64_defconfig Kconfig
from which we conclude that the used file must be arch/x86/configs/x86_64_defconfig.
See also: https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
make help also shows other interesting default related targets like alldefconfig and savedefconfig which may be useful.
add a comment |
Real hardware / distros will likely not work properly with defconfig
As mentioned on this answer, anything that is not given by the distribution or hardware vendor will very likely fail in subtle or less subtle ways, e.g.:
- you might not build driver support for some essential piece of hardware
- packages of the distribution might rely on a feature of the kernel that you did not build and fail
Furthermore, besides specific configs, it is normal for vendors to apply large patchsets on top of the vanilla kernel, even Ubuntu does this for example.
For Ubuntu / Debian in particular, I have described how to compile the supported kernel from source at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171 Modifying that stable kernel base is the sanest thing you can do in that case.
QEMU works with defconfig
One thing that defconfig does nicely though, it to boot on QEMU, tested on kernel v4.20, QEMU 2.12.
Here is a fully automated example with Buildroot.
As noted on that link, you need the following options to boot from disk:
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
although they are not needed for initrd.
For cross compilation to a different arch, e.g. aarch64, you need:
make ARCH=arm64 defconfig
But as explained here, although arm64 does boot on QEMU, it generates a super bloated kernel, and you likely want to roll out something more minimal e.g. as described here.
What make defconfig does exactly?
We can easily see which config file was used with a verbose build:
make V=1 defconfig
which outputs on v4.19:
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig defconfig
scripts/kconfig/conf --defconfig=arch/x86/configs/x86_64_defconfig Kconfig
from which we conclude that the used file must be arch/x86/configs/x86_64_defconfig.
See also: https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
make help also shows other interesting default related targets like alldefconfig and savedefconfig which may be useful.
add a comment |
Real hardware / distros will likely not work properly with defconfig
As mentioned on this answer, anything that is not given by the distribution or hardware vendor will very likely fail in subtle or less subtle ways, e.g.:
- you might not build driver support for some essential piece of hardware
- packages of the distribution might rely on a feature of the kernel that you did not build and fail
Furthermore, besides specific configs, it is normal for vendors to apply large patchsets on top of the vanilla kernel, even Ubuntu does this for example.
For Ubuntu / Debian in particular, I have described how to compile the supported kernel from source at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171 Modifying that stable kernel base is the sanest thing you can do in that case.
QEMU works with defconfig
One thing that defconfig does nicely though, it to boot on QEMU, tested on kernel v4.20, QEMU 2.12.
Here is a fully automated example with Buildroot.
As noted on that link, you need the following options to boot from disk:
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
although they are not needed for initrd.
For cross compilation to a different arch, e.g. aarch64, you need:
make ARCH=arm64 defconfig
But as explained here, although arm64 does boot on QEMU, it generates a super bloated kernel, and you likely want to roll out something more minimal e.g. as described here.
What make defconfig does exactly?
We can easily see which config file was used with a verbose build:
make V=1 defconfig
which outputs on v4.19:
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig defconfig
scripts/kconfig/conf --defconfig=arch/x86/configs/x86_64_defconfig Kconfig
from which we conclude that the used file must be arch/x86/configs/x86_64_defconfig.
See also: https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
make help also shows other interesting default related targets like alldefconfig and savedefconfig which may be useful.
Real hardware / distros will likely not work properly with defconfig
As mentioned on this answer, anything that is not given by the distribution or hardware vendor will very likely fail in subtle or less subtle ways, e.g.:
- you might not build driver support for some essential piece of hardware
- packages of the distribution might rely on a feature of the kernel that you did not build and fail
Furthermore, besides specific configs, it is normal for vendors to apply large patchsets on top of the vanilla kernel, even Ubuntu does this for example.
For Ubuntu / Debian in particular, I have described how to compile the supported kernel from source at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171 Modifying that stable kernel base is the sanest thing you can do in that case.
QEMU works with defconfig
One thing that defconfig does nicely though, it to boot on QEMU, tested on kernel v4.20, QEMU 2.12.
Here is a fully automated example with Buildroot.
As noted on that link, you need the following options to boot from disk:
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
although they are not needed for initrd.
For cross compilation to a different arch, e.g. aarch64, you need:
make ARCH=arm64 defconfig
But as explained here, although arm64 does boot on QEMU, it generates a super bloated kernel, and you likely want to roll out something more minimal e.g. as described here.
What make defconfig does exactly?
We can easily see which config file was used with a verbose build:
make V=1 defconfig
which outputs on v4.19:
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig defconfig
scripts/kconfig/conf --defconfig=arch/x86/configs/x86_64_defconfig Kconfig
from which we conclude that the used file must be arch/x86/configs/x86_64_defconfig.
See also: https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
make help also shows other interesting default related targets like alldefconfig and savedefconfig which may be useful.
edited Feb 8 at 22:16
answered May 20 '15 at 7:42
Ciro Santilli 新疆改造中心 六四事件 法轮功Ciro Santilli 新疆改造中心 六四事件 法轮功
5,19024343
5,19024343
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f29439%2fcompiling-the-kernel-with-default-configurations%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown