View previous topic :: View next topic |
Author |
Message |
janck n00b
Joined: 08 Mar 2013 Posts: 5
|
Posted: Fri Mar 08, 2013 10:57 pm Post subject: Installing Gentoo with precompiled kernel from USB disk |
|
|
Hello!
I'm new with Gentoo and I got a pretty interesting task to do. Before I start with question, I must tell you that I installed Gentoo once for now, and this installation was successfull - without any problems I'm using Linux a few years, but I didn't meet rolling releases before, so that's my first rolling release distribution. I have also some experience with basic Linux commands, so there isn't problems with this because I understand mostly all of them.
What's my job that I have to do?
First of all I need to install Gentoo on some computer with LiveCD - partitioning, chrooting and other stuff. But during the install instead of compiling the kernel, I need to use kernel which I will get on USB disk and I need to import it into the system. I actually don't know how to do that and what this depends on - modules and what else? Also I don't know how to mount USB disk and what do I have to do after I finish this job - do I need to unmount it and when?
How to export already compiled kernel?
As I mentioned, I already installed Gentoo with compiling kernel, so I would like to copy files which are connected with importing the kernel, to USB disk. Why I need them on USB disk? Because I have to practice importing of kernel on my system so after all I could do that without mistakes.
That's it for now
Thanks to all of you! |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sat Mar 09, 2013 12:36 am Post subject: |
|
|
janck,
Welcome to Gentoo.
First to answer the question as you asked it.
The kernel comes in two or optionally three pieces.
The kernel binary file - called bzImage for 32 bit and 64 bit AMD/Intel hardware, when it is built.
The kernel modules - a directory called /lib/modules/<kernel-version>
Optionally, an initramfs file, which is a temporary root filesystem in a file. Some kernels need this to be able to boot.
If you are moving around a generic kernel with initfamfs support, it might work.
If your kernel was built for a specific set of hardware moving it around will probably cause it to fail to boot.
Why do you need to move a kernel around like this?
What problem are you trying to solve. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
janck n00b
Joined: 08 Mar 2013 Posts: 5
|
Posted: Sat Mar 09, 2013 7:56 am Post subject: |
|
|
Actually I got this task for homework because sometime in the future we will have examination about Linux, but computers in school are not fast enough. So instead of compiling we'll get precompiled kernel made for these computers and there will be also limited time to finish all tasks.
In which folder(s) do I need to copy kernel files and how to "register" them to the system that it will recognize it?
Because I need to practice this - which files do I need to copy on USB disk, so that they I can use next time?
What about mounting and unmounting USB disk - how can I check if the disk is plugged in and how to mount and unmount it during installation? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sat Mar 09, 2013 10:44 am Post subject: |
|
|
janck,
There are too many unknowns to be very helpful.
If you are give a complete built kernel tree, you do the install steps in the normal way and set up the boot loader to use the new kernel.
There are three common boot loaders, lilo, grub and grub2 along with several uncommon ones too.
If you have to unpick the kernel from a running install, the steps in my first post apply.
Depending on the distro you are using in school, the mount steps vary from do nothing, as its all automatic.
Find out when the new volume is called, then calling udisks to mount it or calling mount manually.
If you use Gentoo in school, any of the above may apply - Gentoo is about choice.
All of these are the wrong solution to your problem.
You should set up distcc on all the systems in your school, then have all the computers cooperate on the kernel build. You then share the built kernel tree over the network and perform the install steps on each PC. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
janck n00b
Joined: 08 Mar 2013 Posts: 5
|
Posted: Sat Mar 09, 2013 12:43 pm Post subject: |
|
|
Okay. I understand all things, also that on Gentoo, user must compile things hisself and to not use precompiled things, except in certain cases. But I got mentioned homework as I wrote and I'm new to Gentoo and compiling all things, so take the case of new install and let's depend on it.
First time when I want to install Gentoo for practice, I will compile kernel, which I would like to use next times on the same computer. The commands which I enter are:
Code: | #: emerge gentoo-sources
#: emerge genkernel
#: genkernel all |
After this I'll have to manage boot loader and other things which are needed for successful installation. After reboot I will copy kernel files on USB disk, but there I don't know if this are all things which I need to copy:
/boot/kernel-genkernel-x86_64-3.X-gentoo
/boot/initramfs-genkernel-x86_64-3.X-gentoo
/lib/modules/*
After that, I will restart computer and start with new installation. When Gentoo comes to the level when I can start typing in console, I'll need to mount USB disk. How to do that on livecd? When I'll finish things which I have to do till the kernel generating, how to create /boot and /lib/modules? Than I will copy files with 'cp /USB/ /DESTINATION/' and go on with managing of the boot loader. Is this right?
Sorry because I'm asking stupid things, but I would really like to do the homework and after that to good pass an examination. Thanks for your time! |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sat Mar 09, 2013 2:05 pm Post subject: |
|
|
janck,
Copying
Code: | /boot/kernel-genkernel-x86_64-3.X-gentoo
/boot/initramfs-genkernel-x86_64-3.X-gentoo
/lib/modules/* | is correct.
Boot the PC, when you have logged in, connect the USB drive. Wait a few seconds, then run the dmesg command.
A lot of text will scroll by but you only need the piece at the end. I get, Code: | [10040.299240] scsi 15:0:0:0: Direct-Access USB DISK 2.0 PMAP PQ: 0 ANSI: 0 CCS
[10040.299393] sd 15:0:0:0: Attached scsi generic sg12 type 0
[10041.601226] sd 15:0:0:0: [sdk] 7827456 512-byte logical blocks: (4.00 GB/3.73 GiB)
[10041.601689] sd 15:0:0:0: [sdk] Write Protect is off
[10041.601691] sd 15:0:0:0: [sdk] Mode Sense: 23 00 00 00
[10041.602204] sd 15:0:0:0: [sdk] No Caching mode page present
[10041.602207] sd 15:0:0:0: [sdk] Assuming drive cache: write through
[10041.605300] sd 15:0:0:0: [sdk] No Caching mode page present
[10041.605303] sd 15:0:0:0: [sdk] Assuming drive cache: write through
[10041.632765] sdk: sdk1
[10041.637365] sd 15:0:0:0: [sdk] No Caching mode page present
[10041.637369] sd 15:0:0:0: [sdk] Assuming drive cache: write through
[10041.637371] sd 15:0:0:0: [sdk] Attached SCSI removable disk |
The important line is Code: | [10041.632765] sdk: sdk1 | which tells my USB drive is sdk and has a single partition sdk1. That tells that I need to mount /dev/sdk1.
Code: | mount -t vfat /dev/sdk1 /mnt/cdrom | will mount my USB drive at the /mnt/cdrom mount point.
You may use any directory as a mount point. Make a new one in /mnt if you want to.
Now I can copy things to /mnt/cdrom and they go to the USB drive.
When you are finished, you must unmount the drive before your remove it.
Code: | sync
sync
umount /dev/sdk1 |
The first sync tells the kernel to flush all the disk buffers to the hard drive. The second sync will block until the first sync completes. When the second sync completes you get the prompt back. At that point we know that all the data has been written to the drive and its safe to unmount the drive.
Depending on the amount of data and type of drive, the second sync may take minutes to complete. If you are impatient, the data will not actually be on the drive when you remove it and your filesystem will be corrupt. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
janck n00b
Joined: 08 Mar 2013 Posts: 5
|
Posted: Sun Mar 10, 2013 10:20 am Post subject: |
|
|
I have tried to do as you wrote, but I got a problem when copying /lib/modules/3.X-gentoo. Inside modules's folder are two symbolic links:
Code: | /source -> /usr/src/linux-3.X-gentoo |
and
Code: | /build -> /usr/src/linux-3.X-gentoo |
So if I try to copy modules with command
Code: | cp -r /lib/modules/3.X-gentoo/ /mnt/USB/ |
I always get a list of errors:
Code: | cp: cannot create symbolic link /mnt/USB/3.X-gentoo/build: Operation not permitted
cp: cannot create regular file /mnt/USB/3.X-gentoo/kernel/net/netfilter/xt_hl.ko: File exists
cp: cannot create regular file /mnt/USB/3.X-gentoo/kernel/net/netfilter/xt_tcpmss.ko: File exists
cp: cannot create regular file /mnt/USB/3.X-gentoo/kernel/net/netfilter/xt_DSCP.ko: File exists
cp: cannot create symbolic link /mnt/USB/3.X-gentoo/source: Operation not permitted |
USB disk have FAT file system and there is no any other problem than copying that files on above list. When copying that files there are no any before versions of that, on USB disk are only kernel and initramfs. What can I do now? |
|
Back to top |
|
|
LiamOS n00b
Joined: 06 Jun 2012 Posts: 62 Location: Ireland
|
Posted: Sun Mar 10, 2013 2:45 pm Post subject: |
|
|
I'm not sure if this will be helpful, but I've done an install of the following form for a friend:
- Did a normal install up to the kernel section.
- Get a USB stick and machine running Ubuntu.
- Copy /boot/vmlinux-x-y-z-generic (kernel image), /lib/modules/<same version>, /boot/initramfs-x-y-z
- Move these to the same location in Gentoo as they were in Ubuntu, and update your bootloader accordingly.
I had no problems with the above. _________________ CFLAGS=" -O999999" |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Sun Mar 10, 2013 4:06 pm Post subject: |
|
|
janck,
FAT32 does not support symbolic links. Make a not of them on paper and recreate them.
They are not actually needed for just running the kernel though.
The failed copy is the result of multiple attempts - thats why the file exists. It should be safe to ignore but you can remove the kernel from the USB disk and do it again to be sure. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
janck n00b
Joined: 08 Mar 2013 Posts: 5
|
Posted: Sun Mar 10, 2013 6:32 pm Post subject: |
|
|
I copied all things which I mentioned in post before and without /build and /source directories which are symbolic links. After all I rebooted computer and did the thing with copying kernel. When I installed all things on computer and rebooted it again, it works like it should.
Thanks to all, espacially NeddySeagoon and for your time! |
|
Back to top |
|
|
|
|
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
|
|