Forum Discussion
Altera_Forum
Honored Contributor
20 years agoThis is about modules. We will install the modules tree and update the busybox to use "modprobe".
The busybox in release1.4 from microtronic can not support modules in trees. Download the latest update from http://busybox.net/downloads/snapshots/bus...napshot.tar.bz2 (http://busybox.net/downloads/snapshots/busybox-snapshot.tar.bz2). Newer update has more features and fixs. I used the one built on 20051220. Place it in /usr/local/src/nios2. # rename the old busybox, so you can still use it when you need cd /usr/local/src/nios2 mv busybox busybox-1.00-pre8 tar jxf busybox-snapshot.tar.bz2 cd busybox Update the Makefile and Rules.mak in busybox.*** Makefile 2005/12/27 13:07:23 1.1
--- Makefile 2005/12/28 00:46:02
***************
*** 211,219 ****
endif# ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
! busybox: .depend $(libraries-y)
$(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
! $(STRIPCMD) $@
busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
- $(SHELL) $^ >$@
--- 211,228 ----
endif# ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
! busybox: busybox.elf
! nios2-elf-elf2flt -s 16000 -o $@ $<
!
!#
!# Make a relocatable ELF file.
!#
! %.elf : %.bin
! $(LD) -T /usr/local/nios2-elf/scripts/elf2flt.ld -Ur -o $@ $<
!
! busybox.bin: .depend $(libraries-y)
$(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
!# $(STRIPCMD) $@
busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
- $(SHELL) $^ >$@
***************
*** 328,334 ****
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h
! .config.old busybox
- rm -rf _install testsuite/links
- find . -name .\*.flags -exec rm -f {} \;
- find . -name \*.o -exec rm -f {} \;
--- 337,343 ----
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h
! .config.old busybox *.bin
- rm -rf _install testsuite/links
- find . -name .\*.flags -exec rm -f {} \;
- find . -name \*.o -exec rm -f {} \;
*** Rules.mak 2005/12/27 12:56:02 1.1
--- Rules.mak 2005/12/28 00:55:09
***************
*** 72,83 ****
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
!# LIBCDIR:=/usr/i386-glibc20-linux
#
# For other libraries, you are on your own. But these may (or may not) help...
!# LDFLAGS+=-nostdlib
!# LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
!# CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char
# GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
--- 72,83 ----
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
# using the compatible RPMs (compat-*) at http://www.redhat.com !
! LIBCDIR:=/usr/local/nios2-elf
#
# For other libraries, you are on your own. But these may (or may not) help...
! LDFLAGS+=-nostdlib -Wl,-r -Wl,-d -L$(LIBCDIR)/lib $(LIBCDIR)/lib/crt0.o
! LIBRARIES:=-lc -lm -lgcc
! CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I/usr/local/src/nios2/build/kernel/include -funsigned-char -iwithprefix include -D__uClinux__
# GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
***************
*** 103,108 ****
--- 103,109 ----
-e 's/sh/sh/'
-e 's/mips-.*/mips/'
-e 's/mipsel-.*/mipsel/'
+ -e 's/nios2-.*/nios2nommu/'
-e 's/cris.*/cris/'
)
endif make menuconfig make make install The .config of busybox must have, ## Build Options#
CONFIG_STATIC=y
CONFIG_LFS=y
USING_CROSS_COMPILER=y
CROSS_COMPILER_PREFIX="nios2-elf-"
EXTRA_CFLAGS_OPTIONS="-Dfork=vfork"
CONFIG_FEATURE_SUSv2=y
CONFIG_FEATURE_SUSv2_OBSOLETE=y
# # Installation Options# # CONFIG_INSTALL_NO_USR is not set
CONFIG_INSTALL_APPLET_SYMLINKS=y# CONFIG_INSTALL_APPLET_HARDLINKS is not set# CONFIG_INSTALL_APPLET_DONT is not set
PREFIX="/usr/local/src/nios2/build/rootfs" If your nios2 does not have hw mul, add "-mno-hw-mul" to extra cflags above. If your nios2 does have hw mulx, add "-mhw-mulx" to extra cflags above. "-mhw-mul" is the default. Next, we will update the kernel Makefile, and install modules into rootfs. cd /usr/local/src/nios2/linux-2.6.x Update Makefile ,as it should be in newer kernels. *** Makefile~ 2005-12-16 11:19:34.000000000 +0800
--- Makefile 2005-12-27 13:34:02.000000000 +0800
***************
*** 894,900 ****
ifeq "$(strip $(INSTALL_MOD_PATH))" ""
depmod_opts :=
else
! depmod_opts := -b $(INSTALL_MOD_PATH)/lib/modules -r
endif
.PHONY: _modinst_post
_modinst_post: _modinst_
--- 894,900 ----
ifeq "$(strip $(INSTALL_MOD_PATH))" ""
depmod_opts :=
else
! depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
.PHONY: _modinst_post
_modinst_post: _modinst_ make ARCH=nios2nommu O=/usr/local/src/nios2/build/kernel CROSS_COMPILE=nios2-elf- INSTALL_MOD_PATH=/usr/local/src/nios2/build/rootfs# ## update the rootfs with modules added make ARCH=nios2nommu O=/usr/local/src/nios2/build/kernel CROSS_COMPILE=nios2-elf- You should enable modules support in kernel, and module utilities (insmod,rmmod,lsmod,modprobe) in busybox. The kerenl modules tree will be installed into the INSTALL_MOD_PATH/lib/modules/2.6.11-uc0/kernel/... and modules.dep will be generated. Then the "modprobe" command will work now. eg modprobe vfat will load fs/fat/fat.ko and fs/vfat/vfat.ko. If you have CF/Microdrive/IDE or other block devices, you can use it to store the modules. Either, 1. Mount it as root, without initramfs. Flash devices are not recommand for root, because of the limited write life. Config the kernel command line to "root=/dev/hda1", and disable initramfs. You should have the device driver and file system compiled in, instead of modules. The FAT/VFAT does not support symlink, and can not be used as root if you want busybox. Consider minix if the root part size <64MB, or ext2 for larger disk. Mount and copy the rootfs to your device, with cp -a. 2. Mount it as /lib, over the initramfs, and keep the initramfs small. Change the modules install path to another dir, then cd lib of this and cp -a to the devices. The ext3 and reiserfs still have some problem in kernel compilation. I am checking. Patch to support minix for /usr/local/src/nios2/linux-2.6.x/include/asm-nios2nommu/bitops.h *** bitops.h 2005/11/10 06:55:12 1.1
--- bitops.h 2005/11/10 06:56:58
***************
*** 469,472 ****
--- 469,479 ----
# define ext2_find_first_zero_bit find_first_zero_bit
# define ext2_find_next_zero_bit find_next_zero_bit
+ /* Bitmap functions for the minix filesystem. */
+# define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
+# define minix_set_bit(nr,addr) set_bit(nr,addr)
+# define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+# define minix_test_bit(nr,addr) test_bit(nr,addr)
+# define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
+
# endif /* _ASM_NIOS_BITOPS_H */