Hi Everyone As I saw a mail from Madhu Kiran with regard of forming a final image as part of the Kernel (i.e. dictionary part of the Kenel build). I knew this since openbios.full has kernel and dictionary built to-gether its correct right. The answer corresponds to the answer given by Stefan Reinauer.
I'm cross compiling Kernel-1.1 for my embedded processor still I havent updated my BSP part but I'll do it later once the dictionary and kernel independent part is built properly. Is it ok to go in this Way.
So while cross compiling kernel-1.1 using cross compiler on Linux based machine was able to compile Kernel part and the unix folder (Host) with changes done in the Makefile. The steps doing so are as follows:
1. In kernel-1.1 arch Documentation forth include kernel Makefile plugins README Rules.make Util
In Makefile
ARCH := $(shell uname -m | sed -e s/i.86/mips/)
Commented forth.html and plugins since I dint want .html to be formed and plugins since is was giving some error When compiled for x86.
all: main unix dictionary $(ARCH) # forth.html plugins
2. In directory /util
types.sh changes are
if [ -z "$CC" ]; then CC=mips_fp_le-gcc # cross compiler option for Target Board fi
#echo "void *pointersize;" > types.c #$CC -c -o types.o types.c #PTRSIZE=$(( 8 * 0x`nm types.o| grep pointersize | cut -f1 -d\ ` )) #rm -f types.c types.o
PTRSIZE=32 # since my Target is 32-bit processor
3. In arch/unix I made the chages with the following line added as per the little endian option
CC := mips_fp_le-gcc
include $(TOPDIR)/Rules.make
Can we do this ....
It even compiles the unix directory with the cross compiler option.
4. It gives problems with dictionary file what may be the problem with the following error code
[root@localhost kernel-1.1]# make
Welcome to OpenBIOS..
Creating build directory /home/viswa/kernel-1.1/obj-mips Checking types... Checkings in types.sh updated by SoCrates found 32bit platform, creating "types.h"
Building common core files for architecture mips compiling primitives.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling stack.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling dict.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling lib.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling openbios.c... ok In Rules.make Compiler Used mips_fp_le-gcc
Building files for unix hosted bootstrap compiling unix.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling plugins.c... ok [root@localhost obj-mips]# cd .. [root@localhost kernel-1.1]# make clean Cleaning up architecture mips [root@localhost kernel-1.1]# make
Welcome to OpenBIOS..
Creating build directory /home/viswa/kernel-1.1/obj-mips Checking types... Checkings in types.sh updated by SoCrates found 32bit platform, creating "types.h"
Building common core files for architecture mips compiling primitives.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling stack.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling dict.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling lib.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling openbios.c... ok In Rules.make Compiler Used mips_fp_le-gcc
Building files for unix hosted bootstrap compiling unix.c... ok In Rules.make Compiler Used mips_fp_le-gcc compiling plugins.c... ok In Rules.make Compiler Used mips_fp_le-gcc linking unix bootstrap... -rdynamic -ldl ok Bootstrapping dictionary.../bin/sh: ./unix: cannot execute binary file make[1]: *** [bootstrap.dict] Error 126 make: *** [dictionary] Error 2
This error is due to since we are trying to execute on different architecture to form the dictionary File.
Is there anyway to bypass or use Host compiler for dictionary forming and finally use this later along With the final image formation.
5. Is the image openbios.full a binary image or elf format and how to link to ROM i.e using ld sript to Map for the Target ROM address.
6. But with x86 was able to compile the kernel-1.1 without compiler option of forth.html and plugins Which could not find some ./config file what is the correction for it and why the plugins are needed.
In advance Thanks Viswa
Hi Viswa,
* Vishu@soc-soft.com Vishu@soc-soft.com [040823 09:12]:
I'm cross compiling Kernel-1.1 for my embedded processor still I havent updated my BSP part but I'll do it later once the dictionary and kernel independent part is built properly. Is it ok to go in this Way.
OpenBIOS still lacks support for cross compiling, though this would be a valuable feature. I suggest you also have a look at the latest snapshots (available at bk://openbios.bkbits.net/unstable or http://www.openbios.org/snapshots/ since the kernel has been enhanced a lot since v1.1
- In arch/unix I made the chages with the following line added as per
the little endian option
CC := mips_fp_le-gcc
include $(TOPDIR)/Rules.make
To fix compiler selection in a clean way, we have to distinguish between a HOSTCC for compiling utilities that are needed during build and CC for all files that are created for the target platform.
The KConfig mechanism and the bootstrap compiler need HOSTCC rather than CC.
- It gives problems with dictionary file what may be the problem with
the following error code
[root@localhost kernel-1.1]# make Creating build directory /home/viswa/kernel-1.1/obj-mips Checking types... Checkings in types.sh updated by SoCrates found 32bit platform, creating "types.h"
[..]
Bootstrapping dictionary.../bin/sh: ./unix: cannot execute binary file make[1]: *** [bootstrap.dict] Error 126 make: *** [dictionary] Error 2
This error is due to since we are trying to execute on different architecture to form the dictionary File.
correct.
Is there anyway to bypass or use Host compiler for dictionary forming and finally use this later along With the final image formation.
Since ARM is a 32bit little endian platform you can just build a dictionary for ARM on an x86 machine. The resulting dictionary has the right platform properties (endianess and bit width)
The build process should then use the bootstrap compiler rather than the "unix" binary to create the "rest" of the dictionary. This way we can build the unix hosted binary for the target platform while we have a native bootstrap compiler.
NOTE: With a little bit of effort it should be possible to create a bootstrap compiler that can cope with different bit width and endianess combinations, too. Basically only the memory access primitives (@, !, w@, w!, l@, l!) have to be adapted.
- Is the image openbios.full a binary image or elf format and how to
link to ROM i.e using ld sript to Map for the Target ROM address.
openbios.full is a static elf binary. I've been using it as a "payload" for LinuxBIOS which wants such an ELF binary. To create a binary image you can use objcopy. It's easier to use an IPL program with a small ELF loader though since it copes with all relocation issues for you..
- But with x86 was able to compile the kernel-1.1 without compiler
option of forth.html and plugins Which could not find some ./config file what is the correction for it and why the plugins are needed.
What is the exact error message. Does this still happen with above snapshots?
With the plugins the unix hosted binaries can be enhanced. It's for example possible to emulate PCI devices in userspace and test and develop drivers without booting the target machine.. There's only a framework for this though and a dummy graphics card emulation using "QT"
Stefan