[uClinux-dev] Start files from initramfs

Brian S. Julin bri at abrij.org
Sat May 29 10:20:00 EDT 2010

I have a pure initramfs working in the deskjet patch, but not with
busybox.  It loads the initramfs directly from the romfs build directory,
not from a mounted image.  Had to patch up the vendor makefiles to
make real dev nodes and such.

End result is you have to be careful to delete all of ./romfs/* whenever
you really want to get something to go away, and run make twice because
the romfs build happens after the kernel has already snarfed up what is
in there.  A more elegant way of doing this would be nice.

It sounds like you have further problems somehow, but this worked for me.
My makefile "romfs" target is like this -- the important stuff is the
loop over DEVICES.

         [ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)
         for i in $(ROMFS_DIRS); do \
                 [ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)/$$i; \
         # explode these now... we need real nodes for ramfs
         for i in $(DEVICES); do \
         DEVN=`echo $$i | sed -e 's/,.*//' -e 's,.*/,,'`; \
         MIN=`echo $$i | sed -e 's/.*,//'`; \
         DEVT=`echo $$i | sed -e 's:[^/,]*,:: ' -e 's/,.*//'`; \
         MAJ=`echo $$i | sed -e 's:[^/,]*,:: ' -e 's:[^/,]*,:: ' -e 's/,.*//'`; \
         rm $(ROMFSDIR)/dev/$$DEVN ;\
         mknod $(ROMFSDIR)/dev/$$DEVN $$DEVT $$MAJ $$MIN; \
         # these permissions are needed for openpty and family to work
         # on non-ptmx ptys
         chmod 620 $(ROMFSDIR)/dev/[pt]ty[pqrsPQRS][0-9a-f]
         for i in $(FLASH_DEVICES); do \
                 touch $(ROMFSDIR)/dev/flash/@$$i; \
         dirs=$(DIRS) ; \
         for i in $$dirs; do make -C $$i romfs || exit $? ; done
         $(ROMFSINST) -s /var/tmp /tmp
         $(ROMFSINST) ../../Generic/romfs /
         $(ROMFSINST) ./inittab.vendor /etc/inittab
         $(ROMFSINST) ./rc.vendor /etc/rc
         $(ROMFSINST) ./passwd.vendor /etc/passwd
         $(ROMFSINST) ./group.vendor /etc/group
         if [ $(CONFIG_BLK_DEV_INITRD) = "y" ]; then \
                 ln -sf bin/init $(ROMFSDIR)/linuxrc; \
         echo "$(VERSIONSTR) -- " `date` > $(ROMFSDIR)/etc/version


More information about the uClinux-dev mailing list