Forum Discussion
107 Replies
- Altera_Forum
Honored Contributor
This guide worked for me. Thanks hippo! initramfs cuts down on my flash memory requirements a lot. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
To others planning to use the above guide, here are some things I ran into: - Before starting, make sure you have bison, flex, and dos2unix. Bison and flex are probably available as packages for your Linux distribution. dos2unix is a common tool, but amazingly I didn't have it and my Linux distribution didn't have a package for it! If it's the same with you, then the simplest thing to do is to use the two-line perl script for dos2unix that they give here: http://soft.zoneo.net/linux/dos_to_unix.php (http://soft.zoneo.net/linux/dos_to_unix.php). Name the script "dos2unix" (without any extension), make it executable, and put it in your path. (Note: don't get the fancy dos2unix that converts between DOS, UNIX, and Mac in any direction. It'll break the build.) - The build process for elf2flt tries to use a static libc library, which you might not have. If the build for it fails with an error like "ld: cannot find -lc", then that's probably your problem. However, you can just change the elf2flt build process to use shared libraries. After the build fails due to the error, edit buildroot/toolchain_build_nios2/elf2flt/Makefile and remove the "-static" flag in LDFLAGS. Then run "make" and "make install" in the elf2flt directory to finish it, and then continue the rest of the build process by running "make" in the buildroot directory. - The build process automatically downloads additional source code from predetermined locations on the web. However, I found that some of the sites it tries to access don't exist anymore (or at least they were down when I was doing this). If a program called "wget" keeps trying to download from some URL, that's probably what's wrong. To fix this, google for the last part of the URL that it's trying to access (e.g. "gcc-3.4.3.tar.gz"). You should find a working link to that file somewhere on the first page of results. Use your browser's "Copy Link Location" feature to get the URL of the file. Next, grep the buildroot tree for the URL that wget is using (e.g. grep -R "mirrors\.rcn\.net" ~/buildroot). One of the results should be a line like GCC_SITE=http://mirrors.rcn.net/.../gcc-3.4.3.tar.gz in some makefile or something. Edit that file and change that line to use the URL that you found instead. Then resume the build process by running "make" in the buildroot directory. The wget step should then work. - If you configured your kernel to not support loadable modules, or if you just don't need any on your system, then you can skip the two steps labeled "copy module files to rootfs and generate modules.dep" and "rebuild image for initramfs". As a note, I built buildroot using gcc version 3.4.5. - Altera_Forum
Honored Contributor
removed. goto post#11 for kernel 2.6.15.2
- Altera_Forum
Honored Contributor
merged to post# 1 step2.
- Altera_Forum
Honored Contributor
Hi hippo!
I created a patch for the 2.6.11 kernel to include support for a timer called watchdog configured as a watchdog in SOPC-builder. I think it's not specific to 2.6.11 so you could include this in the patch-set if you like. The more drivers standard available (or in one patch) the more attractive the Nios2 platform gets! Respect for the work you've done so far! Walter Goossens - Altera_Forum
Honored Contributor
It is easy to compile a simple program, as pointed out by leonqin and tschmelcher.
The copy hello to ~/rootfs/bin, and rebuild kernel image for initramfs.nios2-linux-uclibc-gcc hello.c -o hello -elf2flt - Altera_Forum
Honored Contributor
You can use "free" to find out the memory usage.
You can try the following to reduce the memory usage. 1. The default busybox use more options than you will need. You can reduce the commands or features supported by busybox, only keep those you will use. cd ~/buildroot/build_nios2/busybox make menuconfig make cd ~/buildroot make 2. reduce the kernel, reduce unused driver and file system. cd ~/linux-2.6.x make ...... menuconfig make 3. remove unused files and nodes in rootfs/etc and rootfs/dev in file ~/buildroot/target/generic/device_table.txt in dir ~/buildroot/target/generic/target_skeleton 4. you can delete files at run time when they are no longer in use. - Altera_Forum
Honored Contributor
hi hippo:
I have compiled the kernel successed ,then got the vmlinux in /linux-2.6.15.1. But when I exec "made ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- INSTALL_MOD_PATH=/home/alex/rootfs modules_install".I meet a erro. [root@localhost linux-2.6.15.1]# make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- INSTALL_MOD_PATH=/home/alex/rootfs modules_install no emulation specific options. The present kernel configuration has modules disabled. Type 'make config' and enable loadable module support. Then build a kernel with module support enabled. So I ececed "make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- menuconfig" In "modules support" , I seleced "enable modules...." After save, I execed "make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc-" but make failed. I got following erro information: . . . arch/nios2nommu/kernel/setup.c:101:33: warning: "CONFIG_SMC91111" is not definedarch/nios2nommu/kernel/setup.c:101:54: warning: "CONFIG_OPEN_ETH" is not definedarch/nios2nommu/kernel/setup.c:101:75: warning: "CONFIG_MTIP1000_ETH" is not defined arch/nios2nommu/kernel/setup.c:101:100: warning: "CONFIG_DM9000_ETH" is not defined arch/nios2nommu/kernel/setup.c:200:33: warning: "CONFIG_SMC91111" is not definedarch/nios2nommu/kernel/setup.c:200:54: warning: "CONFIG_OPEN_ETH" is not definedarch/nios2nommu/kernel/setup.c:200:75: warning: "CONFIG_MTIP1000_ETH" is not defined arch/nios2nommu/kernel/setup.c:200:100: warning: "CONFIG_DM9000_ETH" is not defined . . . kernel/intermodule.c:178: warning: `inter_module_register' is deprecated (declared at kernel/intermodule.c:38) kernel/intermodule.c:179: warning: `inter_module_unregister' is deprecated (declared at kernel/intermodule.c:78) kernel/intermodule.c:181: warning: `inter_module_put' is deprecated (declared at kernel/intermodule.c:159) CC kernel/extable.o CC kernel/params.o CC kernel/posix-timers.o CC kernel/kthread.o CC kernel/wait.o CC kernel/kfifo.o CC kernel/posix-cpu-timers.o CC kernel/futex.o CC kernel/uid16.o CC kernel/module.o kernel/module.c: In function `load_module': kernel/module.c:1534: error: `EM_ALTERA_NIOS2' undeclared (first use in this function) kernel/module.c:1534: error: (Each undeclared identifier is reported only once kernel/module.c:1534: error: for each function it appears in.) make[1]: *** [kernel/module.o] 错误 1 make: *** [kernel] 错误 2 [root@localhost linux-2.6.15.1]# How can I solve the question? Do I must copy modules fills from MX_1.4 source code to ~/rootfs? Thank you very much! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif - Altera_Forum
Honored Contributor
The current config for 2.6.15.1 has no module enabled. So you should skip this step.
And the vmlinux is ready for download and test. - Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- I don't understand how to update the kernel Makefile for modules install
[/b] --- Quote End --- That's a format of diff/patch command. You can use editor, open Makefile, go to line 897, it was,--- Makefile 2006/01/26 06:13:18 1.1 +++ Makefile 2006/01/26 06:14:23 @@ -894,7 +894,7 @@ ifeq "$(strip $(INSTALL_MOD_PATH))" "" depmod_opts := else -depmod_opts := -b $(INSTALL_MOD_PATH)/lib/modules -r +depmod_opts := -b $(INSTALL_MOD_PATH) -r endif .PHONY: _modinst_post _modinst_post: _modinst_
change it todepmod_opts := -b $(INSTALL_MOD_PATH)/lib/modules -r
Do you remember, we have several "patch" commands in the post? A patch file is generated with the "diff" command. When we change some files, we can find the differences from what they were before we change. Send only the change to others, and he can update the files with "patch" command. So if you save the "diff" to a file, Makefile.diff you can update without using editor, with the commanddepmod_opts := -b $(INSTALL_MOD_PATH) -r
The parameter "-p0" mean cut zero dir level from file header, ie, the files in diff are in the same directory. Sometime, we use "-p1", we cut one level dir level from file header. eg, "linux-2.6.x/Makefile" with "-p1" will be the same as "Makefile" with "-p0" .cd ~/linux-2.6.x patch -p0 <Makefile.diff - Altera_Forum
Honored Contributor
UPDATE : merged to post#1
Here come the latest Linux kernel 2.6.15.3 on Nios2. I did include most of the drivers in the mx1.4 release. But I did not build and test them, because I did not have any dev boards to test out. Only serial console is tested.