2

I want to boot my imx53-qsb board using not a normal rootfs but a statically compiled hello_world.c file in other words a hello_world_static.out. To achieve that, I wrote a hello_world.c file cross compiled it statically and I put it in my mmcblk0p1 ext4 partition of my sd card. I put my uImage and my u-boot.imx in the mmcblk0. After booting my system I got a kernel panic :

Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

Any solution ? Thanks

EngineerN
  • 133
  • 2
  • 11
  • Please provide the code of your `hello_world.c` file. Also tell us which exactly toolchain you are using for building it. – Sam Protsenko May 26 '15 at 17:45
  • @SamProtsenko here is my hello_world.c code ` #include int main(void) { printf("hello, world\n"); return 0; } ` I compiled it with _gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux_ – EngineerN May 27 '15 at 07:53

1 Answers1

1

You should provide init= param to kernel cmdline (from u-boot). For example, if your binary file name is init and you have put it to /sbin directory (on your rootfs partition), you should add init=/sbin/init to your kernel cmdline in u-boot (in bootargs variable).

For example you can do next (in u-boot shell, before running bootm or booti command):

setenv bootargs root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/sbin/init

Also, check if you really have your rootfs on mmcblk0p1. Usually mmcblk0p1 is FAT32 partition which contains bootloader files and images to copy to RAM. Rootfs is usually located on mmcblk0p2 (and formatted as ext4).

For details see:

[1] Documentation/kernel-parameters.txt (look for init= param)

[2] u-boot README file (look for Boot Linux: line)

[3] Documentation/init.txt

Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
  • @samprotsenkok Thanks for those links ! But what I want is not having the rootfs in my partition, only a static compile hello_world file. I tried to modify u-boot bootargs like this : _optargs=quiet init=/hello_world_static.out_ and _mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}_ but still not work. – EngineerN May 27 '15 at 08:06
  • @samprotsenkok here is my u-boot environment variables : _bootargs_base=setenv bootargs console=ttymxc0,115200_ **AND** _bootargs_mmc=root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/hello_s.out_ **AND** _bootcmd_mmc=run bootargs_base bootargs_mmc;mmc dev 0;mmc read ${loadaddr} 0x800 0x4000;bootm_ **AND** _bootcmd=run bootcmd_mmc_ When I boot with those parameters, I got a different error : _Please append a correct "root=" boot option; here are the available partitions:_ – EngineerN May 27 '15 at 09:02
  • @EngineerN Yeah, I wasn't actually saying anything about actual rootfs, but you still need some partition called `rootfs` formatted as `ext4`. Any your rootfs is basically just that one file of yours. – Sam Protsenko May 27 '15 at 09:35
  • @EngineerN Try this: `setenv bootargs console=ttymxc0,115200 root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/hello_s.out`, and then run your boot command. Also, are you sure that your first partition is where your binary resides? – Sam Protsenko May 27 '15 at 09:41
  • Ah ok. I just tried what you said but I still got the same error. Yes I am sure, I formatted the partition as ext4. When I put a "normal" rootfs it works well. Thank you for your help man ;) – EngineerN May 27 '15 at 11:08
  • What do you mean "the same error"? Which exactly, `invalid root=` or `invalid init=`? – Sam Protsenko May 27 '15 at 15:58
  • This one _error : Please append a correct "root=" boot option; here are the available partitions:_ Any idea ? – EngineerN May 28 '15 at 09:20
  • Hmm, maybe it worth to add `rootwait` param to cmdline (i.e. to `bootargs` variable in u-boot). Also check that you have correct `root=` param in your kernel cmdline (somewhere at the top of kernel log output, look for `Kernel command line:` text). Here is my cmdline to run my board: `root=/dev/mmcblk0p2 rw console=ttyO2,115200 init=/init rootfstype=ext4 rootwait`. – Sam Protsenko May 28 '15 at 13:04
  • I put this _setenv bootargs_mmc root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait init=/hello_s.out_ but on the log in the kernel command line there is a problem : _Unknown command 'root=/dev/mmcblk0p1' - try 'help'_ Can we move to the chat to talk about it ? or you prefer staying here ? – EngineerN May 28 '15 at 13:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/79035/discussion-between-sam-protsenko-and-engineern). – Sam Protsenko May 28 '15 at 15:42