How to make an initrd.img in Ubuntu? - ubuntu-10.04

[Environment: Ubuntu 10.04]
I've just finished compiling Linux-2.6.20 and wanna make it work, so I think I should add something to my grub2, as I finished
make modules_install
make install
in /boot/,I got
vmlinuz-2.6.20
System.map-2.6.20
config-2.6.20
So I just tried
mkinitramfs -o initrd.img-2.6.20 2.6.20
Then the file initrd.img-2.6.20 was generated, but after I type
update-grub2
That image file is not found! Does anyone know how to deal with this?
By the way,I really wonder from which files is initrd.img-2.6.20 generated? Because it seemed that I didn't even specify any source to generate this file.

I am using 2.6.32.59 version and the following steps work for me-
#sudo update-initramfs -c -k 2.6.32.59
#sudo update-grub

Related

How do I downgrade Make from 4.2.1 to 3.82?

I want to use make version 3.82, so I am downgrading from version 4.2.1.
After downloading the make-3.82.tar.gz file from the https://ftp.gnu.org/gnu/make/ site, extract the file and run ./configure ./build.sh to create a make file.
if run the make file, I get an error called Segmentation error (core dump).
How do I make make work properly?
If you set ulimit -c unlimited then re-run make, it will generate a core file that you can inspect with gdb to see what happened. You may need to recompile make with -g3 or similar to ensure the binary contains debugging information.

How to get libc on Openwrt?

I'm trying to get libc on OpenWrt as a package, but I can't seem to find it in any of the repositories. I am only able to find the .ipk here.
How do I get it on my configuration as I'm compiling it instead of using opkg?
I am not sure that I correctly understand your question.
If you are compiling the Openwrt, the .ipk should be under <buildroot/bin>. If you would like to just download it, please select the right architecture, for example using ar71xx use the link below: ar71xx - 15.05.1
On the other hand I cant imagine a system without libc installed, please type the following:
opkg list-installed | grep libc
Download the OpenWrt SDK.
Update and install the packages.
cd ~/OpenWrt-SDK-15...
./scripts/feeds update -a
./scripts/feeds install -a
Compile the libc package
make package/libc/compile -j1 V=s
Find it in bin/packages/...
If it fails find the libc package for OpenWrt and copy to /feeds/packages/libs. Update the package by typing ./scripts/feeds/update -i && ./scripts/feeds/install libc and go to the step 4 again.

add path when installing mpich in ubuntu

I know there are many tips online about installing mpich2 in linux/ubuntu, but I just do not know how to add path so that each .c/.f90 file can see the 'mpif.h'.
I think I have successfully installed mpich2 on my machine. Because when I run
mpiexec -np 3 ./cpi
It works. cpi is a application in the 'example' file. But when I tried to run gcc -o mpitest hellow.c. It always said undefined reference to MPI_INIT and some similar errors.
The mpiexec mpirun are in /usr/local/bin and mpif.h mpi.hare in /usr/local/include. So how to add path?
Thanks in advance!
You don't need to add a anything to your PATH. What you need to do is to link your application with the MPI libraries.
MPI installations provide a useful wrapper for this. Simply replace gcc by mpicc:
mpicc -o mpitest hellow.c

arm-none-eabi commands will not install correctly

I'm attempting to install a toolchain for assembly code on the raspberry pi. I used the following procedure to install the package files:
$ wget http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/os/downloads/arm-none-eabi.tar.bz2
--2012-08-16 18:26:29-- http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/os/downloads/arm-none-eabi.tar.bz2
Resolving www.cl.cam.ac.uk (www.cl.cam.ac.uk)... 128.232.0.20, 2001:630:212:267::80:14
Connecting to www.cl.cam.ac.uk (www.cl.cam.ac.uk)|128.232.0.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 32108070 (31M) [application/x-bzip2]
Saving to: `arm-none-eabi.tar.bz2'
100%[======================================>] 32,108,070 668K/s in 67s
2012-08-16 18:27:39 (467 KB/s) - `arm-none-eabi.tar.bz2' saved [32108070/32108070]
$ tar xjvf arm-none-eabi.tar.bz2
arm-2008q3/arm-none-eabi/
arm-2008q3/arm-none-eabi/lib/
arm-2008q3/arm-none-eabi/lib/libsupc++.a
arm-2008q3/arm-none-eabi/lib/libcs3arm.a
...
arm-2008q3/share/doc/arm-arm-none-eabi/info/gprof.info
arm-2008q3/share/doc/arm-arm-none-eabi/info/cppinternals.info
arm-2008q3/share/doc/arm-arm-none-eabi/LICENSE.txt
$ export PATH=$PATH:$HOME/arm-2008q3/bin
That appeared to work, the package files are in the correct place.
~/arm-2008q3/bin $ ls
arm-none-eabi-addr2line arm-none-eabi-gcc-4.3.2 arm-none-eabi-objdump
arm-none-eabi-ar arm-none-eabi-gcov arm-none-eabi-ranlib
arm-none-eabi-as arm-none-eabi-gdb arm-none-eabi-readelf
arm-none-eabi-c++ arm-none-eabi-gdbtui arm-none-eabi-run
arm-none-eabi-c++filt arm-none-eabi-gprof arm-none-eabi-size
arm-none-eabi-cpp arm-none-eabi-ld arm-none-eabi-sprite
arm-none-eabi-g++ arm-none-eabi-nm arm-none-eabi-strings
arm-none-eabi-gcc arm-none-eabi-objcopy arm-none-eabi-strip
However, when I go to make, I get the following outcome.
arm-none-eabi-as -I source/ source/main.s -o build/main.o
make: arm-none-eabi-as: Command not found
make: *** [build/main.o] Error 127
Thanks in advance for any help.
export PATH=$PATH:$HOME/arm-2008q3/bin is only valid in the shell it is executed in (and any shells spawned from that shell). So you either use that shell instead of opening a new one to execute make or edit your ~/.bashrc (see Unix: Getting Export PATH to "Stick")
I encountered the same problem and in my case the problem was that I was running a 64-bit operating system and the package to be used is a 32-bit. The fix was to install i32-libs package which allows running 32-bit applications on a 64-bit system.
# apt-get install ia32-libs
You have to direct your compiler to the right path where arm-none-eabi-as is located. You can do so by
export PATH=$PATH:/file_path_goes_here/
When you compile, you should have no problems as the compiler will now know where to look.

asm/errno.h: No such file or directory

While building gcc, I get this error:
In file included from /usr/include/bits/errno.h:25,
from /usr/include/errno.h:36,
from ../.././gcc/tsystem.h:96,
from ../.././gcc/crtstuff.c:68:
/usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory `/opt/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'
I am building gcc 4.1 from source. I think I have to install build-essential. However installing that package in ubuntu 12.04 will automatically download and install gcc 4.6 and I don't want that.
Is there any other way?
I think the package you want is linux-libc-dev . I encountered this when building 32-on-64; so I needed linux-libc-dev:i386 .
This worked for me:
ln -s /usr/include/asm-generic /usr/include/asm
This worked for me:
sudo ln -s /usr/include/asm-generic /usr/include/asm
The reason being that what GCC expects to be called /usr/include/asm is renamed to /usr/include/asm-generic in some distros.
This fixed it for me.
sudo apt-get install linux-libc-dev:i386
This solved it for me on Debian 10, even though I was compiling with an LLVM-based compiler:
sudo apt install gcc-multilib
/usr/include/asm/errno.h is part of the linux headers. I can't speak directly to Ubuntu 12.04, but in general you can download the linux sources as a package for your distro and it shouldn't require you to download/install gcc. Failing that, you can manually download the linux headers for the version of your kernel (uname -a) and use an include directive to CFLAGS to specify the directory to look for those.
Edit: sudo apt-get install linux-headers-generic may work for you.
You are missing part of the development packages. I don't know Ubuntu, but you should be able to ask it's package management system to install the package containing /usr/include/asm/errno.h.
Do not copy some file with a similar name from somewhere on your system (or, even worse, from somewhere else). Missing files might mean that some package is damaged; again, ask your package manager to check everything and (re)install missing/broken pieces.
Unless you are running some LTS release, upgrade. Your Ubuntu is some 2 years old, i.e., ancient.
While we are at this, why on this beautiful planet are you building such an ancient compiler? Current GCC is just released 4.9.0, anything before 4.7 is ancient history, not longer supported.
On Ubuntu 16.04 x86_64 you could try this:
ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm
This works on my server.
If you want to use errno.h that is in the asm file, simply go to /usr/(ctrl + l, type /usr/) and then search for errno.h and errno-base.h. Once you did find them, copy the code in these two files, and place them in your include folder. And be careful, in "errno.h" the file includes "errno-base.h" as:
#include <asm-generic/errno-base.h>
Either create a directory with the same name above or change the code above to something different which is suitable for you to use.
If you can find:
usr/include/asm-generic/errno.h
by executing:
find /usr/include -name errno.h
then try to execute:
cp --archive /usr/include/asm-generic /usr/include/asm
It may fix that problem.
I had this issue while compiling Asterisk 1.8.24.0 and solved it with:
mkdir /usr/include/asm-generic
cp /usr/include/asm/errno-base.h /usr/include/asm-generic/
Don't know if it is the "right way" but i've read the comments above and that gave me the idea... and it worked :)

Resources