1 uClinux course Day 2 of 5 Using configuration tools and the tool chain
2 Author: D L Johnson Configuration tools u Linux/Unix has a key advantage over windows due to its modularity – kernel or application components can be added or removed easily u This makes it very suitable to embedded environments where many typical PC peripherals such as keyboards and screens are not present u The uClinux configuration script allows kernel components and applications to be added and removed u The uClinux environment uses two different menu configuration environments +For X windows environments a graphical menu system –make xconfig +For terminal environments a text based menu system –Make menuconfig
3 Author: D L Johnson Configuration tools Select Target Platform Selection u type make menuconfig from a terminal window +Use, and to navigate through menus and to select check boxes Select (……..) Vendor/Product To change the host processor you are compiling for. We will use (GDB/ARMulator) for the simulator and (Atmel/AT91) for the real hardware later in the course
4 Author: D L Johnson Configuration tools Selecting Kernel version u linux-2.4.x or linux-2.0.x depending on the size/feature set you need Selecting Libc version u glibc is the original unadapted libc, it is the largest library u uC-libc is the original library for uclinux, API’s not always standard – some routines not present u uClibc fixes problems with original uC-libc although it is a little larger than uC-libc u If you want to change Kernel settings select the check box [X] Customise Kernel Settings (NEW) with [X] Customise Kernel Settings (NEW) with u If you want to add or remove user applications select the check box [X] Customise Vendor/User Settings with [X] Customise Vendor/User Settings with u When you are finished highlight Exit and press u When you are finished highlight Exit and press
5 Author: D L Johnson Configurations tools You are then brought back to this screen and you ask yourself … huh, I chose to change Kernel settings and all I can do is or go back to Target Platform Selection … or go back to Target Platform Selection … Against all logic … Select Against all logic … Select Whizz, pop ….
6 Author: D L Johnson Configurations tools … Linux Kernel Configuration screen … Linux Kernel Configuration screen u Some important options to set + + to set up RAM and FLASH addresses + + to activate/deactivate networking + + to choose networking protocols u When you are finished highlight Exit and press u When you are finished highlight Exit and press
7 Author: D L Johnson Configuration tools u Select to save new kernel configuration
8 Author: D L Johnson Configuration tools … Customize user settings for uClinux … Customize user settings for uClinux u Some important options to set + + contains all the common applications such as gunzip, grep, ln, chown … + + contains common network apps such as dhcp, ftp, ifconfig … u When you are finished highlight Exit and press u When you are finished highlight Exit and press
9 Author: D L Johnson Configuration tools u When you are finished configuring uClinux type the following commands to build the kernel and the userland +make dep&& make u If you only want to build the userland type +make user_only +Make romfs +make image u Go and make coffee or take a jog.. This can take a few minutes
10 Author: D L Johnson Adding User applications u Files to edit: u user/Makefile u Add a line to the file like u u dir_$(CONFIG_USER_FOO_FOO) += foo u u This adds the directory 'foo' to the list of directories to be built. I added u mine in alphabetical order. The order doesn't seem to matter. u u config/Configure.help u This file contains the text which is presented on request during the u config. u Add a block like u u CONFIG_USER_FOO_FOO u This program does fooey things to your bars. u u The text must be indented two spaces, and there must be no empty lines. Lines u should be <70 chars long.
11 Author: D L Johnson Adding User applications u config/config.in: u Add a line in the apropriate menu section (i.e. in the program group you want u your app to show up in during 'make config'; I used 'misc'), like u u bool 'foo' CONFIG_USER_FOO_FOO u u The repetition of FOO allows for directories which contain multiple u executables. Thus, if the user directory 'foo' contained code to make 'foo' u and 'bar', each gets its own config line if an additional entry is made like u u bool 'bar' CONFIG_USER_FOO_BAR u
12 Author: D L Johnson Adding User applications u Next, there needs to be a proper /user/foo/Makefile. The Makefile should follow u the following template: u u EXEC = foo u OBJS = foo.o u all: $(EXEC) u $(EXEC): $(OBJS) u $(CC) $(LDFLAGS) -o $(OBJS) $(LDLIBS) u romfs: u $(ROMFSINST) /bin/$(EXEC) u clean: u -rm -f $(EXEC) *.elf *.gdb *.o u
13 Author: D L Johnson Adding User applications u If more than one executable is built in the foo directory, as above, then the u Makefile should look like u u u EXECS = foo bar u OBJS = foo.o bar.o u all: $(EXECS) u $(EXECS): $(OBJS) u $(CC) $(LDFLAGS) -o $(LDLIBS) u romfs: u $(ROMFSINST) -e CONFIG_USER_FOO_FOO /bin/foo u $(ROMFSINST) -e CONFIG_USER_FOO_BAR /bin/bar u u u More complex makefiles are of course possible. The reader is encouraged to u browse the user tree for examples. u u When all this is set up, doing the standard 'make xconfig; make dep; make' u should build the app and install it in romfs and hence in the target system u image.bin.
14 Author: D L Johnson Adding User applications u Assignment 1 Add an application which prints the following on the the stdout display of uClinux – use the simulator Add an application which prints the following on the the stdout display of uClinux – use the simulator * *** *** ***** ***** ******* *******
15 Author: D L Johnson The tool chain The compile process cc1 as ld cpp