Find the answer to your Linux question:
Results 1 to 10 of 10
Hey guys, I want to start playing around with the linux kernel but I have some questions to get going. Can I build on windows in cygwin or mingw and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    6

    Building the kernel - newbie


    Hey guys,
    I want to start playing around with the linux kernel but I have some questions to get going.

    Can I build on windows in cygwin or mingw and then either run through some VMWare? Or just transfer to another computer and boot it from there? Cos I have a linux machine and I have a windows machine, but if I wreck the kernel, which I suspect I will do, then how do I restore my linux system? Thats why I want to do it on my windows system. I am trying to do it through Cygwin but it doesn't understand elf so, I don't know what to do. I have tried mingw but get the same elf issues but I'm told this can act as a cross compiler?

    Basically I'm just really looking for some pointers in the right direction. I have tried googling but to no avail (which leads me to believe its not practical - or at least quite difficult)

    Thanks,
    Stephen

  2. #2
    Linux Enthusiast Manchunian's Avatar
    Join Date
    Dec 2007
    Location
    France but my heart stays in Britain
    Posts
    675
    Hi,

    You'll still be able to boot up in your old kernel, so if you cock up building your new one, you can boot up the old one and do any repairs you need.
    Distribution: Archlinux
    Processor: 3 x Amd 64 bit
    Ram: 4 GB
    Graphics card: Nvidia GeForce 9800 GT

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    6
    Quote Originally Posted by Manchunian View Post
    Hi,

    You'll still be able to boot up in your old kernel, so if you cock up building your new one, you can boot up the old one and do any repairs you need.
    Thanks for the response? So is building on windows not a goer?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User dxqcanada's Avatar
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    259
    Building a kernel/modules on one system and then transferring it to another is not recommended for those that are not experienced with it.

    If you are building from different sources than your current running kernel is fine. You would normally have a unique entry in your boot loader for your new kernel and you always have the option of loading your original kernel.

    If you are building from the same sources as your running kernel then you can append a version to the new kernel.

    General setup -> Local version

    If you append a local version then your kernel/modules will not conflict with your current kernel.



    Men occasionally stumble over the truth,
    but most of them pick themselves up
    and hurry off as if nothing had happened.

    Winston Churchill


    ... then the Unix-Gods created "man" ...

  6. #5
    Just Joined!
    Join Date
    Dec 2007
    Posts
    6
    Quote Originally Posted by dxqcanada View Post
    Building a kernel/modules on one system and then transferring it to another is not recommended for those that are not experienced with it.
    So how do I get experience So is it possible to build it on my own windows system and then run it in some kind of VMWare? I'd rather not mess around with my linux machine cos its not really for development.

  7. #6
    Linux Enthusiast Manchunian's Avatar
    Join Date
    Dec 2007
    Location
    France but my heart stays in Britain
    Posts
    675
    If you're really worried about it, best not do it! Still, the risk is small. I've made loads of mistakes while building my own kernel, but I've always managed to correct them by choosing my previous kernel in the Grub menu. Note, that if you have a graphics card driver installed, you'll be greeted with a black screen and a flashing cursor: you need to re-install this.
    Distribution: Archlinux
    Processor: 3 x Amd 64 bit
    Ram: 4 GB
    Graphics card: Nvidia GeForce 9800 GT

  8. #7
    Linux User dxqcanada's Avatar
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    259
    Quote Originally Posted by sroberts82 View Post
    So how do I get experience
    Experience through failure .. until success.

    If you have any Linux environment ... and kernel sources ... you can build a kernel.

    Most modern kernel's are modular. So if you build a kernel for transfer then you must ensure that you transfer the modules that are also created.
    If you build a monolithic kernel then there will be no modules.

    I will admit I have never done that before.
    I have built many kernels on the same system (I am always tweaking kernel parameters), on average I usually have 3 custom kernels I can boot from in my Grub boot loader.

    When building a kernel for another system you have to be very sure that you have enabled the options for the system you are transferring to.



    Men occasionally stumble over the truth,
    but most of them pick themselves up
    and hurry off as if nothing had happened.

    Winston Churchill


    ... then the Unix-Gods created "man" ...

  9. #8
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by sroberts82 View Post
    Hey guys,
    I want to start playing around with the linux kernel but I have some questions to get going.

    Can I build on windows in cygwin or mingw and then either run through some VMWare? Or just transfer to another computer and boot it from there?
    If you don't want to install linux and boot it, use a VM and install it there. It will be the easiest way.

    Cos I have a linux machine and I have a windows machine, but if I wreck the kernel, which I suspect I will do, then how do I restore my linux system? Thats why I want to do it on my windows system. I am trying to do it through Cygwin but it doesn't understand elf so, I don't know what to do. I have tried mingw but get the same elf issues but I'm told this can act as a cross compiler?
    Mingw can produce win32 objects code on a *nix environment. The opposite is not true. I don't know what are you exactly trying to achieve yet.

    To move a kernel from one installation into another shouldn't add much complexity, but there are some things you need to take into account. All the modules and the kernel must have the same magic version number. That means that you'll need to compile any external module that's not into the mainstream kernel on the same machine, with the same compiler and such.

  10. #9
    Just Joined! brahan_7's Avatar
    Join Date
    Dec 2007
    Location
    Deep South
    Posts
    26
    The best place to build kernel source is in your home directory...you only need root privelages to install the kernel.

    You are better off NOT using a vm to install the kernel...that will probably just make things harder.

    Check out this article: The Kernel Configuration and Build Process

    You may also want to check out The Linux Kernel in a Nutshell (oreilly) if your going to get serious

  11. #10
    Linux Enthusiast Manchunian's Avatar
    Join Date
    Dec 2007
    Location
    France but my heart stays in Britain
    Posts
    675
    The best place to build kernel source is in your home directory
    I totally agree with this. Every time I build a new kernel this is how I do it. Works a treat!
    Distribution: Archlinux
    Processor: 3 x Amd 64 bit
    Ram: 4 GB
    Graphics card: Nvidia GeForce 9800 GT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •