LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Build LFS on one computer and run it on another (https://www.linuxquestions.org/questions/linux-from-scratch-13/build-lfs-on-one-computer-and-run-it-on-another-887700/)

lich000king 06-22-2011 03:57 AM

Build LFS on one computer and run it on another
 
Hi

I would like to build my LFS on a computer that has an AMD Phenom CPU. But ultimately this LFS should run on another machine with a C2D.

These architectures are quite similar. Is there anything I need to pay attention to, or do I not need to worry about this at all?

Or put differently, is there any benefit of building on the second machine in the first place?

The main reason I want to build on the AMD machine: it is a lot faster.

I have already gone through LFS 6.8 using ubuntu 11.04 as host on said AMD machine successfully.

TobiSGD 06-22-2011 04:31 AM

If you don't use any CPU-specific optimizations you should be fine.

lich000king 06-22-2011 06:12 AM

Thanks for the quick reply.
The only CPU-specific optimizations I can remember are in the "Processor type and features" entry in the kernel config.

So should I just select 386 as processor family?

TobiSGD 06-22-2011 06:22 AM

With Phenom and C2D CPUs I would go for 64 bit, but you can also go for 32 bit. I would choose i686 as common base. Don't forget to compile in the drivers you need for the second machine.
There are also possibilities to compile for a specific CPU with other software than the kernel if you use the -mcpu and -march options of the compiler.

lich000king 06-22-2011 06:54 AM

Quote:

Originally Posted by TobiSGD (Post 4392621)
With Phenom and C2D CPUs I would go for 64 bit, but you can also go for 32 bit. I would choose i686 as common base.

There is no "i686" entry, there is only a "586/K5/5x86/6x86/6x86MX", but I think that is not the same.
(I am looking at the 2.6.39.1 kernel configurator.)

TobiSGD 06-22-2011 07:03 AM

Go for Pentium Pro, that is the i686. Both processors you have (and every other i686-capable CPU) will be able to work with that code.

druuna 06-22-2011 09:40 AM

Hi,

A few possible attention points that come to mind:

- make sure your partition layout is the same on both boxes or adjust your fstab (if you use uuid's, see next comment),
- if you used uuid's in your grub config you need to change these, or switch back to device names,
- if you have created/fixed any udev rules, make sure they are still correct/relevant.

The above depends on when you are going to switch from one box to the other, but you might want to keep them in mind.

Hope this helps.

lich000king 06-22-2011 11:06 AM

Thanks for your answers, both of you.

Regarding the partition layout: I have thought about this and come to the following conclusion:

On the host PC I don't necessarily need to boot into lfs, I can do everything from the chroot environment. Therefore I can create fstab as if I were already on the other machine.

I intend to get lfs to the new machine by making a disk image (using an acronis true image live cd) and restoring it to the new hard disk.

One thing I am not yet sure about is, how I can install grub to work on the new machine without breaking the existing grub on the host.
Maybe I can just install grub to MBR on the new machine using a live CD like
http://www.supergrubdisk.org/rescatux/ and not do anything about it on the host?

druuna 06-22-2011 02:18 PM

Hi,
Quote:

Originally Posted by lich000king (Post 4392921)
One thing I am not yet sure about is, how I can install grub to work on the new machine without breaking the existing grub on the host.

Installing the grub package can be done on your host, configuring it and writing to MBR can be done at a later point, using any live CD.

Once the LFS image is on the new machine's hard disk, boot from the live CD, chroot into LFS and do the grub configuration.

At this point you could also:
- re-do the kernel build if you want/need to.
- re-check your device layout.

Hope this helps.

lich000king 06-22-2011 02:42 PM

Great, I will do it exactly like this.

Thank you very much!

lich000king 06-24-2011 08:59 AM

Edit: see below

Ok, the grub part worked very well.

But now I have a network probem. At boot I get:
"interface eth0 does not exist"
three times in a row.

My guess was the driver was missing, so I recompiled the kernel (on the new machine), installing all the network drivers as modules, just to be on the safe side. Then I redid the dhcpcd-4.0.11 and DHCP-3.0.6 chapters from BLFS (svn-20110620) and also deleted the ipv4 file.

However, this did not solve the problem, I still get the same error (twice now).

The network controller is a standard gigabit onboard one working in every recent Linux distro, so the driver is certainly contained in the kernel.

What am I missing?

Edit:
I think I should have read
http://www.linuxfromscratch.org/lfs/...nown-interface

Updating /etc/modules.conf should do the trick. Though I was under the impression recompiling the kernel should a least install the driver for the network card in the computer from which it is rebuilt. On the old computer I did not install any extra drivers and it worked??

druuna 06-24-2011 09:57 AM

Hi,
Quote:

Originally Posted by lich000king (Post 4394555)

:)

Personally I like my kernel's as small and as static (= no/minimal modules) as possible. And too be honest I only have a basic understanding of automated device handling using modules during installalation. I do believe that activating all, in this case, network interfaces as module isn't enough to activate the correct one automatically at boot. Maybe someone else also reads this and can explain in more detail.

I'm not sure if using a module was a conscious choice made by you. I would rather not use the module, but build it statically, no extra stuff is needed. If the specific card is present in your system it will be picked up (enabling all network devices as static is an option, the correct one is still automatically used, but there is a possibility of warning messages thrown by the cards that are not found).

I would advise you to disable the modules/static entries you don't need once you know which card is used.

Hope this helps.

lich000king 06-28-2011 01:22 PM

Quote:

Originally Posted by druuna (Post 4394594)
Personally I like my kernel's as small and as static (= no/minimal modules) as possible.

So do I.
Installing all the drivers as modules was more like an experiment, to see if it will work.
Now I have gone though LFS again, this time the SVN version (20110620).
I identified the correct driver in the kernel config and installed it (not as a module).

But now I have a grub problem again.
I bootet from liveCD, chrooted and did exactly as described here:
http://www.linuxfromscratch.org/lfs/...er08/grub.html
except I used /dev/sda1

When I reboot, I get one (correct-looking) grub entry. But when I hit enter, I get:
Code:

error: File not found
But what file?

I have seen GRUB was updated to 1.99 in SVN 20110626, but as far as I can tell, this should not make a difference, I haven't tried yet.

druuna 06-28-2011 01:40 PM

Hi,
Quote:

Originally Posted by lich000king (Post 4398218)
But now I have a grub problem again.
I bootet from liveCD, chrooted and did exactly as described here:
http://www.linuxfromscratch.org/lfs/...er08/grub.html
except I used /dev/sda1

When I reboot, I get one (correct-looking) grub entry. But when I hit enter, I get:
Code:

error: File not found
But what file?

I have seen GRUB was updated to 1.99 in SVN 20110626, but as far as I can tell, this should not make a difference, I haven't tried yet.

I'm guessing that it is looking for /boot/vmlinux-2.6.39.2-lfs-SVN-20110626

Is your /boot/grub/grub.cfg correct? If you used /dev/sda1 and did not use a separate /boot partition, it should look something like this:
Code:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod ext2
set root=(hd0,1)

menuentry "GNU/Linux, Linux 2.6.39.2-lfs-SVN-20110626" {
        linux  /boot/vmlinux-2.6.39.2-lfs-SVN-20110626 root=/dev/sda1 ro
}

The bold parts should be the same.

Hope this helps.

lich000king 06-29-2011 12:52 PM

That's exactly it. The file in /boot/ is called vmlinux-2.6.39.2-lfs-SVN-20110620, which is a bit strange. SVN-20110620 contained kernel 39.1, SVN-20110626 contains kernel 39.2.

Now I used the correct filename in grub.cfg.
Et voilą, it boots and the network is also working!

Thanks again!

Edit:

And even more specifically:
The file that needs to be in /boot/grub/grub.cfg is simply the one created after compiling the kernel:
http://www.linuxfromscratch.org/lfs/...08/kernel.html

Code:

cp -v arch/x86/boot/bzImage /boot/vmlinux[...]


All times are GMT -5. The time now is 11:35 AM.