2011-06-09 10:29:45     generic questions on building uClinux images

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-09 10:29:45     generic questions on building uClinux images

Timothy Stotts (UNITED STATES)

Message: 101153   


I have a few questions on the images created by the Blackfin uClinux environment. After reading the documentation, this is still not obvious to me.


At the end of:  make dep && make


make ARCH=blackfin   -C vendors image

make[1]: Entering directory `/home/adi/tools/blackfin-linux-dist/vendors'

make -C /home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E/. dir_v=/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E/. -f /home/adi/tools/blackfin-linux-dist/vendors/vendors-common.mak image

make[2]: Entering directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

mkdir -p /home/adi/tools/blackfin-linux-dist/images

rm -rf /home/adi/tools/blackfin-linux-dist/images/*

make image.rootfs.all

make[3]: Entering directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

/home/adi/tools/blackfin-linux-dist/user/genext2fs/build-host/genext2fs -m 0 -i 1024 -b 5120 -d /home/adi/tools/blackfin-linux-dist/romfs -D device_table-min.txt /home/adi/tools/blackfin-linux-dist/images/rootfs.ext2

/bin/bash /home/adi/tools/blackfin-linux-dist/linux-2.6.x/scripts/gen_initramfs_list.sh -u squash -g squash /home/adi/tools/blackfin-linux-dist/romfs > /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs.contents

awk -f /home/adi/tools/blackfin-linux-dist/tools/dev-table-to-cpio.awk device_table-min.txt >> /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs.contents

echo "slink /init /sbin/init 0755 0 0" >> /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs.contents

/home/adi/tools/blackfin-linux-dist/linux-2.6.x/usr/gen_init_cpio /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs.contents > /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs

lzma -c -9 /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs > /home/adi/tools/blackfin-linux-dist/images/rootfs.initramfs.lzma

/home/adi/tools/blackfin-linux-dist/user/mtd-utils/mkfs.jffs2 --no-cleanmarkers --eraseblock=128 -l -p -d /home/adi/tools/blackfin-linux-dist/romfs -D device_table-min.txt -o /home/adi/tools/blackfin-linux-dist/images/rootfs.jffs2

make[3]: Leaving directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

make image.kernel.all

make[3]: Entering directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

# only rebuild bare kernel images if needed

if test $(bfin-linux-uclibc-size /home/adi/tools/blackfin-linux-dist/linux-2.6.x/usr/initramfs_data.o | sed 1d | awk '{print $1}') -gt 512 ; then \

                make image.kernel.vmlinux.force || exit $? ; \


cp /home/adi/tools/blackfin-linux-dist/linux-2.6.x/vmlinux /home/adi/tools/blackfin-linux-dist/images/vmlinux

bfin-linux-uclibc-strip -g /home/adi/tools/blackfin-linux-dist/images/vmlinux

make[3]: Leaving directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

make image.uimage.all

make[3]: Entering directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

cp /home/adi/tools/blackfin-linux-dist/linux-2.6.x/arch/blackfin/boot/vmImage /home/adi/tools/blackfin-linux-dist/images/vmImage

make[3]: Leaving directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

make[2]: Leaving directory `/home/adi/tools/blackfin-linux-dist/vendors/Bluetechnix/CM-BF537E'

make[1]: Leaving directory `/home/adi/tools/blackfin-linux-dist/vendors'

adi@colinux:~/tools/blackfin-linux-dist$ ls -lh images/

total 13M

-rw-r--r-- 1 adi adi 5.0M Jun  9 10:00 rootfs.ext2

-rw-r--r-- 1 adi adi 1.6M Jun  9 10:00 rootfs.initramfs

-rw-r--r-- 1 adi adi 9.7K Jun  9 10:00 rootfs.initramfs.contents

-rw-r--r-- 1 adi adi 662K Jun  9 10:00 rootfs.initramfs.lzma

-rw-r--r-- 1 adi adi 1.0M Jun  9 10:00 rootfs.jffs2

-rw-r--r-- 1 adi adi 1.8M Jun  9 10:00 vmImage

-rwxr-xr-x 1 adi adi 2.4M Jun  9 10:00 vmlinux



The documentation says there should be a file named 'uImage' for loading onto the hardware. But as shown, there is no such file/symlink.




(1) Why is an ext2 rootfs created? And why is it 5M when the board I specified has 4M of flash?


(2) Why is there a rootfs.initramfs and also a rootfs.jffs2? Isn't this redundant?


(3) What is vmImage? Is that the uClinux equivalent of desktop linux vmlinuz?


(4) What is the command to manually create uImage as my build environment is not creating it, even with: make image




2011-06-09 10:46:54     Re: generic questions on building uClinux images


Message: 101155   




I think maybe you are reading some OLD documentation.


(1)  Start by using 'make distclean' to clean up the build process.


(2)  Next, use 'make menuconfig' or 'make xconfig' to select your platform.


(3)  After configuring, just do 'make'.


No need to specify -C or other parameters.  The '-C' you specified in your e-mail will actually tell make to 'cd vendors' first before doing a make.  It probably didn't compile the kernel properly and didn't get the root make file to build the images.






2011-06-09 10:54:37     Re: generic questions on building uClinux images

Mike Frysinger (UNITED STATES)

Message: 101156   


most of your questions are already covered by the documentation:



the size of the rootfs depends on what you enabled.  if it's too large for where you wish to deploy, then dont enable so much.


files are created based purely on your kernel selection.  if files are missing or not, then it's because of the options you selected in your kernel


the dist also has no way of reading your mind.  so it cant possibly know what is "too big" or "redundant" or anything else.  it can only do what you've configured it to do.




2011-06-09 13:31:29     Re: generic questions on building uClinux images

Timothy Stotts (UNITED STATES)

Message: 101164   




Thank you for your reply. I was reading current documentation and invoking the build environment with:


# make && make dep


The -C output was my copy-and-paste from the terminal output.


Also, the kernel was compiling just fine, as configured.




Thank you for your reply. The link you provided answered some of my questions. I understand now that 'uImage' is the kernel plus root filesystem in one image; and that rootfs images are typically for writing to a separate memory device before booting; and at boot-time, the rootfs is specified by a kernel boot parameter.


I had some of the options listed in the documentation disabled and that was the reason that uImage was not building.


I had assumed that the build environment would know that the board I targeted CM-BF537E has exactly 4M of boot flash. So I was surprised that the ext2 filesystem created was 5M, containing 2M of contents. I assume that this could be used as a persistent filesystem on a flash memory block device.


The files I now have are:


$ ls -lh images/

total 21M

lrwxrwxrwx 1 adi adi   10 Jun  9 11:32 linux -> linux.ext2

-rwxr-xr-x 1 adi adi 7.2M Jun  9 11:32 linux.ext2

-rw-r--r-- 1 adi adi 5.0M Jun  9 11:32 rootfs.ext2

-rw-r--r-- 1 adi adi 1.7M Jun  9 11:32 rootfs.initramfs

-rw-r--r-- 1 adi adi 9.7K Jun  9 11:32 rootfs.initramfs.contents

-rw-r--r-- 1 adi adi 848K Jun  9 11:32 rootfs.initramfs.gz

-rw-r--r-- 1 adi adi 1.0M Jun  9 11:32 rootfs.jffs2

lrwxrwxrwx 1 adi adi   11 Jun  9 11:32 uImage -> uImage.ext2

-rw-r--r-- 1 adi adi 1.7M Jun  9 11:32 uImage.ext2

-rw-r--r-- 1 adi adi 822K Jun  9 11:32 vmImage

-rwxr-xr-x 1 adi adi 2.2M Jun  9 11:32 vmlinux



The remaining question I have is, why is the uImage created called 'ext2'? I selected run from RAM as a kernel option. Will the kernel copy the contents of the ext2 filesystem inside the uImage into a ramfs filesystem at run-time? Was uImage.jffs2 not created because jffs2 is compressed, so is the uImage, and double-compression would be bad in this situation?




2011-06-09 13:32:26     Re: generic questions on building uClinux images

Timothy Stotts (UNITED STATES)

Message: 101165   


That is:


# make dep && make




2011-06-09 15:37:33     Re: generic questions on building uClinux images

Mike Frysinger (UNITED STATES)

Message: 101167   


ext2 would never be used in parallel flash, so its size really doesnt matter


the documentation i pointed you to explains uImage.ext2 already


you cant really run jffs2 out of memory, nor does it make sense, so you'll never see uImage.jffs2