module_platform_driver order and mounting rootf - linux

I am working on some embedded Linux system and I'm trying to run Linux from USB pendrive. I put "root=/dev/sda3 rootwait" to commandline parameters of the Linux but it doesn't recognize the USB at all when it should mount /dev/sda3.
When I try to run from /dev/mmcblk0p2 everything is ok - Linux kernel recognizes this device BEFORE mounting the rootfs. The problem is only when I try to mount USB as a rootfs.
The USB is recognized only when I run the system from initramfs, but it recognized AFTER the rootfs is mounted.
My question is: how can I move initiation of USB subsystem before mounting rootfs?

Related

How are device nodes created in Embedded Linux without udev?

I have a linux built with a buildroot for a Beaglebone wireless board. In the root file system, when it is still on the host and has not been copied to the target, in the /dev folder, there are device files fd, log, stderr, stdin, stdout only. When I load this root file system on the target and launch the target, there are many more devices - many tty, zero, urandom etc. They are created during the Linux boot process. Buildroot built the system using simple busybox init program. In init scripts i do not see the process of creating device nodes, who creates this device nodes?
Your system is probably using devtmpfs. It is a pseudo filesystem that is mounted on /dev where the kernel will populate device nodes for devices it knows about.
udev relies on devtmpfs since commit 220893b3cbdb ("remove mknod() logic and rely on 'devtmpfs'") which is 9 years old now.
If your target is running busybox, you may have the mdev applet. Look at the installed applets with busybox --help.
mdev uses a configuration file: /etc/mdev.conf

How to load Yocto generated U-boot binaries to t1042d4rdb board

I created linux and U-boot images for NXP t1042d4rdb board using Yocto (using bitbake fsl-image-full command) on Ubuntu 16.04.6 . In my "yocto sdk directory"/"build directory"/tmp/deploy/images/t1042d4rdb directory, I have linux images and many binaries for u-boot (like u-boot.bin, u-boot-sdcard.bin, u-boot-nor.bin, u-boot-spi.bin ....).
you can see my /tmp/deploy/images/t1042d4rdb file here
I attached my UART serial converter to /dev/ttyUSB0 using minicom and wrote this command (found it on nxp forum)
"sudo dd if=u-boot.bin of=/dev/ttyUSB0 obs=4066 seek=1; sync"
nothing happened. Console messages from "dmesg" command
[ 4103.366033] ftdi_sio 3-4:1.0: FTDI USB Serial Device converter detected
[ 4103.366053] usb 3-4: Detected FT232RL
[ 4103.370147] usb 3-4: FTDI USB Serial Device converter now attached to ttyUSB
I am new at Yocto and U-boot. My question is, how can I load U-boot linux binaries to my board. Thanks for answers and any other suggestions.
Firstly, you cannot write serial port device (ttyUSB0) directly with dd despite it is not show any error your written data probably disappears because ttyUSB0 device just a communication device.
On Yocto build directory (tmp/deploy/images) you can probably find an .sdcard image file or an .wic image which is combined Linux kernel, U-Boot and Rootfs images. So you need to write this image to related block device that you will use as boot device. In this case you can write this image like this; "dd if= of=/dev/your-sd-card-device bs=1M sync".
I hope it will help your problem.

Difference between wic and hddimg format in yocto

I have generated a core-image-minimal image for my Intel board in Yocto.
Looking into tmp/deploy/images folder they are many images.
I flashed *.wic image using dd command on USB and it created two partitions ( Boot and Platform ) and allowed only to perform a live booting without allowing it to install on the hard disk of the board.
I then flashed *.hddimg on the USB using dd command. It only created a "boot" partition which has rootfs.img, syslinux and EFI folder.
Booting using USB provided me an "Install" option, which installed on the board and when I rebooted after installing, it displays "No bootable media found"
Using bootable image there are two partitions in the hard disk. Why it is not booting..
Steps followed:
Created an minimal yocto image using "bitbake core-image-minimal" command
Flashed the USB using the dd command.
sudo dd if=tmp/deploy/images/intel-corei7-64/core-image-minimal-intel-corei7-64.hddimg of=/dev/sdb
Clicked on install and typed “sda”
The installation was successful and when I tried to restart by removing the USB Drive, it says “No boot options found. Please install bootable media and restart."
What is the mistake I am doing here.
Which image to choose and when..
There was not much info about online, so I asked this question in the intel community and here is the response of that:
Generally a .wic image is intended to be installed directly to its final destination, whereas an hddimg is for evaluation and installation elsewhere.
By default meta-intel .wic images only have an EFI bootloader, and will not boot via legacy BIOS.
An hddimg will have both an EFI bootloader and the syslinux binaries that let it boot from legacy BIOS.
On startup with your installer USB image do you get a light gray screen with four options? If so it is booting via legacy BIOS.

load routerOS Drivers from USB drive in linux

I'm trying to install routerOS(Mikrotik) from bootable USB drive on my PC.
it boots from USB at first and loads the Linux Kernel.
after detecting the H.D.D it requests me to insert the CD-ROM disk to installing the DRIVERS.
but the drivers are in the USB flash.
i opened the syslinux.cfg and isolinux.cfg files:
default system
label system
kernel linux
append load_ramdisk=1 initrd=initrd.rgz root=/dev/ram0
i'm thinking that the problem is here. it requests to load from CD-ROM.
how can i tell it to load the drivers from USB Flash?
** i've not worked with Linux.
In RouterOS you have 2 method of X86 installs.
CD-ROM ( not USB )
NetInstall
If your BIOS supports net boot and you have a Windows to run NetInstall, try with Mikoritk NetInstall

Not booting RAM file system embedded in Linux Kernel

We have a Linux embedded system that we would like to boot from Flash file system, but have a RAMFS embedded into the kernel that can be seen by the kernel after boot.
Is it possible to embed a RAM File system inside the Linux Kernel (v3.3), that can be used after kernel boot, that the kernel does not use for booting?
Thanks.
Absolutely! Just make a script which mounts a tmpfs on your preferred mount point and that extracts in it a tarball that has been bundled in you rootfs.

Resources