Compiling new linux Kernel

I have a linux system which was installed on a very small hard disk of the size 2GB , meant to be embeded system , the kernel version is 2.6.10 and was compiled by the system supplier to support very limited set of drivers , also almost all development utilities are removed from the file system , i managed to move the system to another PC with larger hard disk by taking an image with 'dd' and restore it , however i faced the problem that kernel cant detect the network card and a lot of other system prepherals m my question is :
1- How to increase the linux root file system size
2- How to Compile and install a new kernel to detect all hardware , noting that the system is a minimized version which doesnt have gcc and other things.
3- Note that the kernel .config file doesnt exist , means also i dont know which options were configured in the exisiting kernel , how can i detect which options are enabled in it.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1) how to increase the linux root file system size:

check if you have sufficient available unallocated disk space you can use temporarily while you do this
if not, add a second disk, just for the purposes of the data migration.
boot the box with a rescue disk, like knoppix, or if you prefer your distro specific livecd.
create a new partition to copy your /boot data, and if you are picky about WHERE on the disks your partitions are, you might not have room to enlarge your current /boot if there are other partitions after /boot make partions in the extra space and copy that data to the newly created partitions.

check to make sure the copies copied everything, like an md5 checksum or something.

once happy, delete the original /boot partitions, and any others you need to delete, and recreate them with the right sizes.

copy the recued data BACK to the new partitions and then boot to make sure everythings works, if it doesnt reboot with the livecd and edit /etc/fstab and your boot loader configuration to make sure you are booting from the correct drive.

once the system boot correctly and you are happy that the copy restore operation worked like you wanted, you can delete the temp partions and remove the extra drive if you installed one, and if  you want put the empty space in service somewhere.

2) without a compiler, you cant compile and install a new kernel.  so install the needed build tools gcc, make, autoconf, etc.

then you can compile a kernel.

3) kernel modules are stored seperatly and you can do a "lsmod" and figureout which modules are installed, you can also do a dir listing on the modules directory and get a list of all kernel options that were complied as Modules.

Maybe someone else can help you to dianose a running kernel, to see what options were built into a running kernel as static build options.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
2) How to Compile and install a new kernel to detectall hardware , noting that the system is a minimized version whichdoesnt have gcc and other things.

You can compile kernel on another system and then copy to the needed place. Try also using kernel from similar distribution (maybe supplier used some common distro) it might boot too.

3) Note that the kernel .config file doesnt exist ,means also i dont know which options were configured in the exisitingkernel , how can i detect which options are enabled in it.

Sometimes you can get kernel config by simply executing this command:
cat /proc/config

But it might not be configured in kernel, especially if developer where trying to minimize as possible.
esam9831Author Commented:
i found the kernel config file under /proc , it is compressed , this solves part of the problem .
1- which tools are required to recompile the kernel , i need explicit list ?
2- How to install them noting that the system is having the bare minimum binaries

I appreciate the detailed steps rather than general tips and guidance
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Just as a beginning what architecture is the embedded system (x86, x86_64 or any other)? What is the kernel version?
esam9831Author Commented:
It is x86 , the kernel version is 2.6.10
As for resizing, since you've already created a partition table using dd, your easiest solution will probably be to use 'resize2fs' or similar.  Booting from a rescue CD of some type will likely simplify this.

As for the kernel, if a custom compile is needed, I would compile this on another system, and copy it over once you're ready.

While I appreciate your goal, and wanting step-by-step instructions, doing it on the local system would be a hugely time-intensive task, unless the distro is based on something "standard" (e.g. Red Hat), for which you can readily install tools like gcc, kgcc, and a lot of libraries.

Your best bet with the kernel is going to be to use a stock RHEL/Cent/etc. kernel from another system; copy over the kernel and initrd files, edit the lilo.conf or grub.conf to use these (modify the existing lines to match the new location).  If grub, it will work automatically, if lilo, reinstall lilo by running `/sbin/lilo`.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.