2

How do I prevent the kernel from pivoting and overwriting the initial file system?
What switches do I pass to the kernel?
Do I need to add any code to the initramfs?

I cross-compiled busybox and installed it into the default directory of _install.
Then I pointed to this directory in the kernel menuconfig (CONFIG_INITRAMFS_SOURCE).
My zImage now contains the cpio file known as initramfs.
When I boot (u-boot bootm 0xkernel - 0xdtbBlob) the kernel will error out with "Unable to mount rootfs on unknown block device".
As I understand it, the kernel is looking for the "real file system" to overwrite the "initial file system". I think this is called a 'pivot'.
I think I want to keep my initial file system intact, at least for now.
I want to use the initramfs I created and included in the zImage.

It seems that everything I have read so far is for:
a ramdisk (block device). I do not want to use because I only have 8M of memory.
a real file system. No mmc,sd,network available. I load all files into memory wrapped into a sb file.
a older kernel or way of doing things. I am using kernel 4.x and u-boot 2015.x

Hardware:
* Freescale imx233 embedded
* 8M sdram
* Loading zero keyed sb file to sdram via recovery mode.
* No mmc, sd, network

Goal:
To create a small kernel and file system with only the tools required:
* debug and get the rest of the hardware working such as the LCD screen and USB port.
* To flash nand with files from usb.

thank you

  • It looks like this user has made this work. (unix.stackexchange.com/questions/213193/…). See the quote "Now normally an initramfs is temporary, only used to run some programs extremely early in the boot process. After those programs run, control is turned over to the real filesystem running on a physical disk. However you do not have to do that. There is nothing stopping you from running out of the initramfs indefinitely." What things need to be setup for this to work? Just an overview would help. – jc__ Aug 28 '15 at 14:15
0

In the root of the initramfs, create a symlink to the busybox binary, called init. For instance, if the root is the directory _install and the busybox binary is at _install/bin/busybox:

cd _install
ln -s bin/busybox init
(re-compile and copy kernel)

No kernel cmdline required. The kernel defaults to run /init* in the initramfs. Busybox, being a multi-call library, will emulate the behavior of the utility it has been called as. Meaning, it will now emulate init, which normally executes inittab. If you did not disable it in the Busybox build, it has a default inittab compiled in. This default one will setup the tty's with shell access for you.

*) The kernel actually default to linuxrc or init, but they are the same thing for Busybox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.