Forum Discussion
uClinux without Flash (again)
I decided to give uClinux a try on my custom board, but I only have an SD card slot, no CFI. When reading the install guide for uClinux, and when trying it, it won't let me build a kernel project without a CFI device present? Is there any way to get around this? It seems odd that I can't build the kernel and run from DRAM, and then write to the SD Card if I wish to boot...
Thx!58 Replies
- Altera_Forum
Honored Contributor
There is no free MMC driver on NIOS right now. And I am writing one using PIO. I will open it when ready.
The Slackware is old and good, and I had been using it more than ten years. There is no problem to generate the tools chain. I never uses the Window's/IDE tools chain. I built them on Linux since the very early beta. The shipped NIOS2 for Linux use newlib, and lack the elf2flt to build busybox and apps. The source of the GND tools can be selected on the packages list when you install NIOS2. They will be installed into the dir altera/kits/nios2/bin/nios2-gnutools/src. I use these before I work on uclinux about one month ago, then I built the one from marc's page. So I have two tools chain now. To build the tools chain follow the marc's page. In build root menuconfig, set binutils ver to 2.15, gcc 3.4.3, and no busybox. I think the problem is still dos2unix. I had the same truncated zip problem when I use the original kernel source tree from microtronix. I had to remove dos2unix, and convert the source tree to fix the CRLF with zip -r and unzip -a to anther dir. You can try to convert the source tree on Linux, then compile them under windows. - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by hippo@Nov 26 2005, 07:54 PM there is no free mmc driver on nios right now. and i am writing one using pio. i will open it when ready.the slackware is old and good, and i had been using it more than ten years. there is no problem to generate the tools chain.
i never uses the window's/ide tools chain. i built them on linux since the very early beta.
the shipped nios2 for linux use newlib, and lack the elf2flt to build busybox and apps.
the source of the gnd tools can be selected on the packages list when you install nios2.
they will be installed into the dir altera/kits/nios2/bin/nios2-gnutools/src.
i use these before i work on uclinux about one month ago, then i built the one from marc's page.
so i have two tools chain now.
to build the tools chain follow the marc's page.
in build root menuconfig, set binutils ver to 2.15, gcc 3.4.3, and no busybox.
i think the problem is still dos2unix. i had the same truncated zip problem when i use the original kernel source
tree from microtronix. i had to remove dos2unix, and convert the source tree to fix the crlf with
zip -r and unzip -a to anther dir. you can try to convert the source tree on linux, then compile them under windows.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=11176)
--- quote end ---
--- Quote End --- OK, - so I think I get it now - the microtronix is a kernel source tree specifically targeted for Cygwin and the Eclipse IDE, while the process on Marcs page is a different kernel source tree targeted for linux, correct? The two are independant of eachother I'm guessing.. So for the cygwin method, you are suggesting that I zip up the microtronix tree in linux using 'zip', and unzip to another directory (shared in windows) in linux using unzip, and then try to build using that? (or perhaps overwriting the original microtronix tree with the unzipped version). And remove the dos2unix line also...
- Altera_Forum
Honored Contributor
Not exactly, the marc's are from the microtronix. Just remove the CRLF and dos2unix and some cygwin
path. Then merge back to uclinux release. They are basically the same. I restore the dos2unix again, but can't get the same error. Please install marc's tools chain. You can also try, zip -r , rename the kernel tree, and unzip -a. Remove the dos2unix in the kernel Makefile, with a Linux editor. Adding# as comment will not work. You can not use windows editor, they will add CRLF. Then compile using windows tools. You can check the kernel usr dir, try gunzip initramfs_data.cpio.gz. To see if the gz is OK. If gunzip is OK, the AS is just .incbin of it, then it should be the tool's problem. - Altera_Forum
Honored Contributor
Well, I tried building the toolchain described by Marc, and I used the uClibc version on his site, patched the buildroot like he said, and used gss versions 3.4.3 and 3.4.2, no busybox, and the build fails with:
make -C internals make[4]: Entering directory `/mnt/usbhd/jdhar/buildroot/toolchain_build_nios2/uClibc/libc/misc/internals' "/mnt/usbhd/jdhar/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-"gcc -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -Os -funit-at-a-time -fno-builtin -nostdinc -D_LIBC -I../../../include -I. -isystem /mnt/usbhd/jdhar/buildroot/build_nios2/staging_dir/lib/gcc/nios2-linux-uclibc/3.4.2/include -DNDEBUG -c __uClibc_main.c -o __uClibc_main.o __uClibc_main.c:23:23: asm/errno.h: No such file or directory __uClibc_main.c: In function `__check_one_fd': __uClibc_main.c:72: error: `EBADF' undeclared (first use in this function) __uClibc_main.c:72: error: (Each undeclared identifier is reported only once __uClibc_main.c:72: error: for each function it appears in.) __uClibc_main.c: At top level: __uClibc_main.c:70: warning: '__check_one_fd' defined but not used __uClibc_main.c:92: warning: '__check_suid' defined but not used I got the binaries from marc directly, so I will try getting the 2.6.9 kernel and patching it as instructed on the page - but I'm not hopeful that it will work either... I tried removing the extra LFs by zipping/unzipping (I verified that it did remove them in fact).. and I replaced the linux-2.6.x directory in the microtronix setup files with the new directory and reinstalled. When I build, I get this at the very end: nios2_system.h: init/.version.o.d: done. LD init/built-in.o LD .tmp_vmlinux1 KSYM .tmp_kallsyms1.S AS .tmp_kallsyms1.o ./..tmp_kallsyms1.o.d: not found make[1]: *** [.tmp_kallsyms1.o] Error 127 make: *** [_all] Error 2 make: Leaving directory `/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x' I changed the makefile from: dos2unix $(depfile); to just: $(depfile); I also tried removin the line altogether, and it didn't work... on the plus side though, it seems like it removed the Warning about the CPIO Archive - Altera_Forum
Honored Contributor
You should use kernel ver 2.6.11, as it was in microtronix v1.4.
You should already get the kernel build in cygwin !! The dos2unix does not matter. (?) Check the vmlinux file. After some search in the Makefile and Kconfig, the last error was from ksymall for debug which is from, menuconfig -> kernel hacking -> full Symbolic/Source debuggin support. You can safely disable it. - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by hippo@Nov 27 2005, 07:57 PM you should use kernel ver 2.6.11, as it was in microtronix v1.4.you should already get the kernel build in cygwin !!
the dos2unix does not matter. (?)
check the vmlinux file.
after some search in the makefile and kconfig, the last error was from ksymall for debug
which is from,
menuconfig -> kernel hacking -> full symbolic/source debuggin support.
you can safely disable it.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=11186)
--- quote end ---
--- Quote End --- I disabled it, and it's still giving me that error... no options on in kernel hacknig, and I'm using as few kernel options as possible. I converted the linux-2.6.x tree using zip/unzip, but should I do the same with my project directory also? Ie, with the .config file... I don't think it would make a difference since only output is being placed there. I don't understand how come this is so difficult to do in Windows... there must be something else I'm doing wrong?
- Altera_Forum
Honored Contributor
I try the cygwin console, it just failed in making the Initramfs.
It is time to move to Linux. Linux is much faster than cygwin, too. You can use the GNU tools in NIOS2 for Linux platform. I did try it. Make sure the altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-linux-gnu/bin is in your path. You can use the "unzip -a" of the kernel tree of microtronix as I did it. Then 1. make ARCH=nios2nommu CROSS_COMPILE=nios2-elf- hwselect SYSPTF=your.ptf 2. make ARCH=nios2nommu CROSS_COMPILE=nios2-elf- menuconfig 3. make ARCH=nios2nommu CROSS_COMPILE=nios2-elf- Below is the sample .config # # Automatically generated make config: don't edit# Linux kernel version: 2.6.11-uc0# Mon Nov 28 22:35:10 2005# # CONFIG_MMU is not set# CONFIG_FPU is not set CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set CONFIG_GENERIC_CALIBRATE_DELAY=y # # Code maturity level options# CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y # # General setup# CONFIG_LOCALVERSION=""# CONFIG_BSD_PROCESS_ACCT is not set# CONFIG_SYSCTL is not set# CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14# CONFIG_HOTPLUG is not set# CONFIG_IKCONFIG is not set CONFIG_EMBEDDED=y CONFIG_KALLSYMS=y# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_CC_ALIGN_FUNCTIONS=0 CONFIG_CC_ALIGN_LABELS=0 CONFIG_CC_ALIGN_LOOPS=0 CONFIG_CC_ALIGN_JUMPS=0 CONFIG_TINY_SHMEM=y # # Loadable module support# # CONFIG_MODULES is not set # # Processor type and features# # # Platform dependant setup# CONFIG_NIOS2=y# CONFIG_MICROTRONIX_UKIT is not set# CONFIG_MICROTRONIX_STRATIX is not set# CONFIG_MICROTRONIX_CYCLONE is not set# CONFIG_MICROTRONIX_PSK is not set CONFIG_ALTERA_STRATIX=y# CONFIG_ALTERA_STRATIX_PRO is not set# CONFIG_ALTERA_STRATIX_II is not set# CONFIG_ALTERA_CYCLONE is not set# CONFIG_ALTERA_CYCLONE_1C12_EVAL is not set# CONFIG_NIOS2_HW_MUL_OFF is not set CONFIG_NIOS2_HW_MUL=y# CONFIG_NIOS2_HW_MULX is not set # # Miscellaneous Options# # CONFIG_AVALON_DMA is not set# CONFIG_PIO_DEVICES is not set CONFIG_EXCALIBUR=y# CONFIG_BREAK_ON_START is not set# CONFIG_LARGE_ALLOCS is not set CONFIG_RAMKERNEL=y# CONFIG_PREEMPT is not set CONFIG_CMDLINE="" # # Bus options (PCI, PCMCIA, EISA, MCA, ISA)# # CONFIG_PCI is not set # # PCCARD (PCMCIA/CardBus) support# # CONFIG_PCCARD is not set # # PC-card bridges# # # PCI Hotplug Support# # # Executable file formats# CONFIG_KCORE_AOUT=y CONFIG_KCORE_ELF=y CONFIG_BINFMT_FLAT=y# CONFIG_BINFMT_ZFLAT is not set# CONFIG_BINFMT_SHARED_FLAT is not set# CONFIG_BINFMT_MISC is not set # # Power management options# # CONFIG_PM is not set # # Device Drivers# # # Generic Driver Options# CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y# CONFIG_FW_LOADER is not set # # Memory Technology Devices (MTD)# # CONFIG_MTD is not set # # Parallel port support# # CONFIG_PARPORT is not set # # Plug and Play support# # # Block devices# # CONFIG_BLK_DEV_FD is not set# CONFIG_BLK_DEV_COW_COMMON is not set# CONFIG_BLK_DEV_LOOP is not set# CONFIG_BLK_DEV_RAM is not set CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_INITRAMFS_SOURCE="/home/uc/root" CONFIG_INITRAMFS_ROOT_UID=500 CONFIG_INITRAMFS_ROOT_GID=500# CONFIG_CDROM_PKTCDVD is not set # # IO Schedulers# CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # # ATA/ATAPI/MFM/RLL support# # CONFIG_IDE is not set # # SCSI device support# # CONFIG_SCSI is not set # # Multi-device support (RAID and LVM)# # CONFIG_MD is not set # # Fusion MPT device support# # # IEEE 1394 (FireWire) support# # CONFIG_IEEE1394 is not set # # I2O device support# # # Networking support# # CONFIG_NET is not set# CONFIG_NETPOLL is not set# CONFIG_NET_POLL_CONTROLLER is not set # # ISDN subsystem# # # Telephony Support# # CONFIG_PHONE is not set # # Input device support# # CONFIG_INPUT is not set # # Userland interfaces# # # Input I/O drivers# # CONFIG_GAMEPORT is not set CONFIG_SOUND_GAMEPORT=y# CONFIG_SERIO is not set# CONFIG_SERIO_I8042 is not set # # Input Device Drivers# # # Character devices# # CONFIG_VT is not set# CONFIG_SERIAL_NONSTANDARD is not set# CONFIG_NIOS_SPI is not set# CONFIG_NIOS_BUTTON is not set # # Serial drivers# # CONFIG_SERIAL_8250 is not set # # Non-8250 serial port support# CONFIG_NIOS_SERIAL=y CONFIG_NIOS_SERIAL_CONSOLE=y# CONFIG_SERIAL_AJUART is not set# CONFIG_UNIX98_PTYS is not set# CONFIG_LEGACY_PTYS is not set # # IPMI# # CONFIG_IPMI_HANDLER is not set # # Watchdog Cards# # CONFIG_WATCHDOG is not set# CONFIG_RTC is not set# CONFIG_GEN_RTC is not set# CONFIG_DTLK is not set# CONFIG_R3964 is not set # # Ftape, the floppy tape device driver# # CONFIG_DRM is not set# CONFIG_RAW_DRIVER is not set # # I2C support# # CONFIG_I2C is not set # # Dallas's 1-wire bus# # CONFIG_W1 is not set # # Misc devices# # # Multimedia devices# # CONFIG_VIDEO_DEV is not set # # Digital Video Broadcasting Devices# # # Graphics support# # CONFIG_FB is not set # # Sound# # CONFIG_SOUND is not set # # USB support# # CONFIG_USB is not set CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y # # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information# # # USB Gadget Support# # CONFIG_USB_GADGET is not set # # MMC/SD Card support# # CONFIG_MMC is not set # # InfiniBand support# # CONFIG_INFINIBAND is not set # # File systems# # CONFIG_EXT2_FS is not set# CONFIG_EXT3_FS is not set# CONFIG_JBD is not set# CONFIG_REISERFS_FS is not set# CONFIG_JFS_FS is not set # # XFS support# # CONFIG_XFS_FS is not set# CONFIG_MINIX_FS is not set# CONFIG_ROMFS_FS is not set# CONFIG_QUOTA is not set# CONFIG_DNOTIFY is not set# CONFIG_AUTOFS_FS is not set# CONFIG_AUTOFS4_FS is not set # # CD-ROM/DVD Filesystems# # CONFIG_ISO9660_FS is not set# CONFIG_UDF_FS is not set # # DOS/FAT/NT Filesystems# # CONFIG_MSDOS_FS is not set# CONFIG_VFAT_FS is not set# CONFIG_NTFS_FS is not set # # Pseudo filesystems# CONFIG_PROC_FS=y CONFIG_SYSFS=y# CONFIG_DEVFS_FS is not set# CONFIG_TMPFS is not set# CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y # # Miscellaneous filesystems# # CONFIG_ADFS_FS is not set# CONFIG_AFFS_FS is not set# CONFIG_HFS_FS is not set# CONFIG_HFSPLUS_FS is not set# CONFIG_BEFS_FS is not set# CONFIG_BFS_FS is not set# CONFIG_EFS_FS is not set# CONFIG_CRAMFS is not set# CONFIG_VXFS_FS is not set# CONFIG_HPFS_FS is not set# CONFIG_QNX4FS_FS is not set# CONFIG_SYSV_FS is not set# CONFIG_UFS_FS is not set # # Partition Types# # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y # # Native Language Support# # CONFIG_NLS is not set # # Kernel hacking# # CONFIG_FULLDEBUG is not set# CONFIG_FRAME_POINTER is not set# CONFIG_MAGIC_SYSRQ is not set# CONFIG_NO_KERNEL_MSG is not set # # Security options# # CONFIG_KEYS is not set# CONFIG_SECURITY is not set # # Cryptographic options# # CONFIG_CRYPTO is not set # # Hardware crypto devices# # # Library routines# # CONFIG_CRC_CCITT is not set# CONFIG_CRC32 is not set# CONFIG_LIBCRC32C is not set - Altera_Forum
Honored Contributor
Ya, I do'nt think it's possible in windows - I just trashed the whole microtronix tree, grabbed the source from the install file, converted it using zip/unzip and installed the converted version, made a new kernel project in the IDE, and tried to compile with no options, and it still gave me the same error...
Since you said the NIOS 2 Linux bins work fine, I won't try using the buildroot method - and I agree that linux should be faster more efficient, it's just all this pain in setting it up. I will try the binaries when I'm at my linux computer, and let you know... Thanks so much! - Altera_Forum
Honored Contributor
Finally some progress (I think)!!
Here is what I did: I converted the microtronix tree and placed it in linux... I then copied the H-i686-pc-linux-gnu/ directory from the Nios II linux CD and set my path to the bin directory in there (with all the elf-* files). I created a filesystem project in Eclipse IDE with very few things, but I have an /bin/init.exe and /etc/inittab in there. I copied the init.exe to /init so it would find it - and my inittab is: # inittab for uClinux# Format:# ttyline:termcap-entry:getty-command# ttyS0:vt100:/bin/agetty 115200 ttyS0# ttyS1:vt100:/bin/agetty 115200 ttyS1 ttyJ0:vt100:/bin/agetty 115200 ttyJ0 I'm guessing I need more things in here? Anyway, some comments: It's still doing dos2unix when I compile in linux using the three make commands you listed.. but I don't get the warning anymore, and it builds successfully. Here's an example: make[1]: `arch/nios2nommu/kernel/asm-offsets.s' is up to date. CHK include/asm-nios2nommu/asm-offsets.h CHK include/linux/compile.h CHK usr/initramfs_list UPD usr/initramfs_list CPIO usr/initramfs_data.cpio GZIP usr/initramfs_data.cpio.gz AS usr/initramfs_data.o dos2unix: converting file usr/.initramfs_data.o.d to UNIX format ... LD usr/built-in.o GEN .version CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o dos2unix: converting file init/.version.o.d to UNIX format ... LD init/built-in.o LD .tmp_vmlinux1 KSYM .tmp_kallsyms1.S AS .tmp_kallsyms1.o LD .tmp_vmlinux2 KSYM .tmp_kallsyms2.S AS .tmp_kallsyms2.o LD vmlinux SYSMAP System.map SYSMAP .tmp_System.map Building modules, stage 2. MODPOST I'm guessing there are dos2unix's elsewhere in the tree Makefiles? Then, I download the .sof to the board, and using sopc builder in windows/cygwin, I do: nios2-download --go ./vmlinux <-- compiled in linux It downloads and runs, and here is the output: Linux version 2.6.11-uc0 ([email protected]) (gcc version 3.4.1 (Altera Nios II 5.0 b86))# 6 Mon Nov 28 14:28:08 EST 2005 uClinux/Nios II Altera Nios II support © 2004 Microtronix Datacom Ltd. Built 1 zonelists Kernel command line: PID hash table entries: 128 (order: 7, 2048 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory available: 14976k/16384k RAM, 0k/0k ROM (750k kernel code, 484k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) Linux NoNET1.0 for Linux 2.6 Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x80801860 (irq = 2) is a jtag_uart io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize Freeing unused kernel memory: 320k freed (0x10da000 - 0x1129000) Warning: unable to open an initial console. So no error on mounting root, which is great.. so I'm not sure about that warning, and I'm going to try and play around with inittab. Is creating the filesystem in Eclipse ok, or is that what buildroot is for in linux? I tried playing aroudn with different filesystems, and it seems that if I have more than just the very minimum (busybox.exe for example), it will fail to mount root altogether (I get a kernel panic/sync error). - Altera_Forum
Honored Contributor
Cheer!!
About the root fs, it should be better to build it by hand. It is simple and clean. I would prefer doing all the works in a shell console, instead of the IDE. The IDE may add something unpredictable. You should build everything in console, and back to IDE when you download and test. You can borrow a lot from Slackware/initrd, in tranditional Linux life style. Setup all the dirs, bin,sbin,etc,dev,usr,usr/bin,var,tmp,proc,sys ... Check if you have all the devices you will use, zero,null,console ( and hda,hda1... etc) It maybe missing /dev/console that give you the warning. Setup the install path to your root fs in Busybox menuconfig. And make install, it will copy and setup the symlinks. Add a symlink /init to /sbin/init for initramfs to work. And a very simple inittab, # Startup the file system null::sysinit:/bin/mount -t proc proc /proc null::sysinit:/bin/mount -t sysfs sysfs /sys # busybox console ::askfirst:/bin/sh You should be sitting in front of busybox prompt now. About the apps, I would prefer add them to busybox. It saves space and troubles.