gilnarya wrote:Just another question, about the two entries in the grub that you suggested. How can I do that?
I'll help out but understand that I'm running Arch Linux so things are going to be slightly differently; mainly what files to modify...other than that the underlying method is the same. There are basically two parts: creating a custom ramdisk and then editing your GRUB entries. Note: All the steps below wiil require root or sudo.
To make a custom ramdisk you'll want to look at the comman mkinitcpio. The Arch Linux
wiki page might help, and you may want to look over similar documentation on the Ubuntu forums.
The first thing you need to do is find out where your current modules are being loaded. In Arch Linux
/etc/rc.conf contains this but that's fairly unique to Arch Linux...in Ubuntu you probably want to look at
/etc/modules. You need to remove whatever your current video module is (NVIDIA or intel....we're going to load it elsewhere).
Next you need to edit
/etc/mkinitcpio.conf. It should be in /etc but you may want to double check....also make a backup of your mkinitcpio.conf (e.g. mkinitcpio.conf.orig). The important part of that file is the line
Yours will probably be empty so you'll want to add the appropriate modules It really doesn't matter which graphics module you load, I just went with the intel (i915) because that's one I use the most. The other module is a chipset module that may or may not be needed, depending on your chipset. You may want to test it or see if it is in
/etc/modules.
Now that you've added the module(s) to mkinitcpio.conf you'll need to generate the ramdisk. This is done simply with
I suggest looking over the mkinitcpio documentation (the Arch link above is good) but I'll give a quick description. The -p flag means that you'll be using a preset configuration found in
/etc/mkinitcpio.d.
Do not mess with the presets.
You now have two images generated by mkinitcpio,
/boot/kernel26.img and
/boot/kernel26-fallback.img. These are the standard images that you've been using, just with a few extras modules being loaded.
Next you'll repeat the steps but for the other video module. Copy your
/etc/mkinitcpio.conf to another name, e.g.,
/etc/mkinitcpio-nvidia.conf. Simply replace the video module in the MODULE line of your new mkinitcpio.conf. For example:
/etc/mkinitcpio.conf
/etc/mkinitcpio-ati.conf
Of course yours should contain the NVIDIA modules, but I don't know what they are. Then you generate another ramdisk, but with a slightly different command:
Code: Select all
# mkinitcpio -c /etc/mkinitcpio-custom.conf -g /boot/kernel26-custom.img
The -c flags tells mkinitcpio which custom conf file to use and the -g flag gives the name of the image that will be created. Make sure to change the names to match your mkinitcpio.conf, e.g.,
Code: Select all
# mkinitcpio -c /etc/mkinitcpio-nvidia.conf -g /boot/kernel26-nvidia.img
That's the hard part. Now that you have two different images from mkinitcpio we need to modify your GRUB file. Usually this is
/boot/grub/menu.lst, but it may vary (e.g. mine is actually /boot/grub/grub.cfg because I'm using a different version of GRUB). Regardless of the fiel, the syntax should be the same. Before I explain, here is my grub.cfg:
Code: Select all
####################
#### BEGIN MENU ####
set timeout=4
set default="0"
set fallback="1"
# Entry 0 - Arch Linux (Intel)
menuentry "Arch Linux (Intel)" --class "arch" {
set root=(hd0,1)
linux /boot/vmlinuz26 root=/dev/disk/by-label/Arch_Root resume=/dev/disk/by-label/Swap radeon.modeset=1 acpi_osi="Linux" ro splash
initrd /boot/kernel26.img
}
# Entry 1 - Arch Linux (Intel Fallback)
menuentry "Arch Linux (Intel) Fallback" --class "arch" {
set root=(hd0,1)
linux /boot/vmlinuz26 root=/dev/disk/by-label/Arch_Root ro
initrd boot/kernel26-fallback.img
}
# Entry 2 - Arch Linux (ATI Video)
menuentry "Arch Linux (ATI)" --class "arch" {
set root=(hd0,1)
linux /boot/vmlinuz26 root=/dev/disk/by-label/Arch_Root resume=/dev/disk/by-label/Swap i915.modeset=1 acpi_osi="Linux" ro splash
initrd /boot/kernel26-ati.img
}
# Entry 3 - Memtest86+
menuentry "Memtest86+" --class "memtest" {
set root=(hd0,1)
linux /boot/memtest86+/memtest.bin
}
#### END MENU ####
####################
The important parts are the lines
initrd /boot/kernel26.img,
initrd boot/kernel26-fallback.img and
initrd /boot/kernel26-ati.img. Change them to match the names of the images you created earlier with mkinitcpio (after you've backed up your original menu.lst).
That should be it! Reboot and select your desired graphics card in the BIOS, then when GRUB loads pick the appropriate GRUB entry. You can check for your card with the command
lspci. There should be a line with something like (this is for my ATI card)
01:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3650
If you chose the Intel card the above line should say something like Intel Grapics Controller.
You can also check that the appropriate modules (ATI here in my case) are loaded with lsmod:
Code: Select all
$ lsmod | grep radeon
radeon 707496 2
ttm 46389 1 radeon
drm_kms_helper 23796 1 radeon
drm 160401 4 radeon,ttm,drm_kms_helper
i2c_algo_bit 5031 1 radeon
i2c_core 17959 6 videodev,i2c_i801,radeon,drm_kms_helper,drm,i2c_algo_bit
and you can check that the other module isn't loaded:
Reboot, switch to the other card, and run the same checks as above.
One thing to note is that if you update your kernle you'll have to run mkinitcpio again. The kernel update should use
/etc/mkinitcpio.conf by default so all you need to do is rung the command for the custom image.
If I've missed anything or you have questions let me know.