Where is g_multi configured in BeagleBone Black? - linux

With the default Debian installation in a BeableBone Black you can access it via USB as different devices: mass storage device, virtual ethernet and virtual serial uart. This is accomplished with the g_multi module. You can review its configuration via files in /sys/module/g_multi/parameters/ .
I am trying to use it only as a mass storage device but with other disk/block device, not the second partition in the boot block device. I have checked that it is always the same partition not matter if it is /dev/mmcblk1p2 (when I have a microSD inserted on boot) or /dev/mmcblk0p2 (without it). I have tried removing g_multi after boot and modprobing g_multi or g_mass_storage with my own configuration, and it works OK.
But I don't want the default configuration to load on startup, so I need g_multi to not load at all, or to load with my own parameters.
I search for its configuration in every place I could think of: configuration for modules in /etc, configuration for systemd, parameters of uboot for kernel, decompiling dtbs, and even with a compiled kernel I searched for the manufacturer that the startup g_multi shows in its /sys/module/g_multi/parameters/iManufacturer in all the files.
I am not able to find anything. Could someone help me?
Thank you very much in advance.

I have finally found it. It is a bit hidden (in a Debian perspective).
It is configured in the /opt/scripts/boot/am335x_evm.sh script.
I had forgotten all those scripts and utilities for the Beagle platforms. I had to follow the major part of the boot proccess.

Related

Device mapper, boot with virtual device

I have a task to make a virtual device under a real one with the help of device mapper kernel module. Virtual device must transfer any request to a real device, so both devices must be equal.
In prospective I should be able to control requests, so I wrote kernel module, representing device mapper target, using this article.
After making module and inserting it (insmod command) I setup my device (dmsetup create). Then do mount and can work with a real device through just created virtual.
But the question is how to repeat above mentioned instructions in boot time? I'd like to use my virtual device as a general one (by changing fstab, I guess).
Thanks in advance!
If you are going to use your device as the root filesystem, you need to create an initramfs that sets it up. Basically a shell script that issues dmsetup commands, followed by a mount and finally pivot_root to the new filesystem.
There was a discussion on the dm-devel mailing list last year on how to do this in the Linux kernel without an initramfs, by specifying mapper lines on the kernel command line. This is they way Chrome OS does it, because they can't/won't use an initramfs. See here for documentation of this feature. The functionality was never merged though.
The patch series was updated and resubmitted in May 2017. Hopefully we will eventually see it merged in some form or other.
If you are not going to use your device as the root filesystem, you can still use the same approach if you want, but there might be easier ways.

How does embedded linux detect file is modified through usb gadget & update files

I have an embedded linux device running a USB gadget kernel module to make the mmc available to the host PC(such as Windows or Linux).
When I update the file in mmc, it won't sync with host PC unless I rmmod and insmod again. Is there any better way to update new files? And how can I detect a file is modified by host PC? I'm using C programming on my linux device.
Thanks.
(1) There really isn't a better way to update new files. You need to take turns and only access the mmc from Linux or Windows, one at a time.
(2) You can't easily do that.
When you say "When I update the file in mmc", I assume that you have the mmc mounted in the linux device, and are updating files from linux at the same time that Windows has mounted the device. I don't think this is advisable. The host (Windows) may cache file and/or directory information from the mmc, and if the embedded Linux changes that information unexpectedly, it may produce errors from the Windows FS, and could corrupt the mmc.
If you want to share files between the embedded Linux and host Windows, and be able to modify them from either OS without taking turns, an alternative solution would be to use the network device gadget and run Samba file sharing on the embedded Linux side to export the filesystem where the mmc is mounted on the Linux side.

Adding drivers to already built CE 6.0 image

Is this possible? I am using a CE image from a manufacturer that won't release a custom image with an extra driver I need.
Give me some good news!
Yes, there is a possibility that you can add your driver over an existing image. You just need to place your driver dll(s) in the required folder (generally Windows folder) in your device where you want it to be and make some registry entries for it. If you already have a .reg file for the driver then you just need to import it on your device.
You can also make a CAB file to avoid the manual work.
It depends. You need to have permanent registry and storage. If you have, then you can configure registry entries to load your driver (at boot or when is detected by USB, SD, PCI etc.) and store it on the device. In some cases drivers are loaded from the image before any storage is mounted and this may prevent you from being able to load your driver at boot (or having your device detected if it's plugged in at boot).

Automatically enabling all ethernet, ATA, SATA, and SCSI drivers in the Linux .config file

I am compiling my own Linux kernel and userland tools for a PXE environment meant for cloning and reimaging. Right now, I'm sticking to a specific kernel version and using preconfigured .config's for building the Linux kernel.
I need to change from using preconfigured .config's to automatically generating the default configuration for the specified architecture, and then enabling all ethernet, ATA, SATA, and SCSI drivers.
The reason I want to do this is:
Updating the kernel means updating the preconfigured .config's, which takes too much time to manually do. The way I'm doing it now is using menuconfig, enabling the options I need, and saving the resulting .config to my repository.
I know the kernel I'm building is missing some drivers because I've encountered some PC's that were not able to mount the NFS share because Linux could not find an ethernet device (which I've verified by booting an Ubuntu CD, which did find the ethernet device). I want an automated way of building any Linux kernel version that will guarantee that ALL drivers I need are pulled in.
Using a distribution's configuration pulls in too many unnecessary drivers and features for my purposes. It lengthens the kernel build time from 10-15 mintues to an hour or more, and the resulting image is too big.
Does anyone know how to write a Bash script to accomplish this?
Have you considered using a text editor to modify the .config file.
Then you can modify it using search and replace.
Plus, there are other choices for configuring the kernel than the menu-driven "menuconfig".

OS reload on a remote linux machine

If we need to do OS reload on a remote machine, how can the network boot be enabled on the client machine without making any changes in the BIOS ??
I am in a try to develop a control panel, in which this feature is included. i.e., fully automated OS reload and thinking of using the pxe boot. But enabling and disabling boot from network is a problem. Any work around, please ?
Hacker approach: Use the bootloader to load GPXE from the harddisk.
You'll need a version that fits to your NIC: Images for many hardware types and booting methods can be generated at ROM-o-matic. Use the PCI ID from the NIC to programmatically select the version that fits best. People may also have add-on network cards, e.g. for gigabit LAN.
This way you don't need to fiddle with the mainboard and network card specific ways to turn PXE on.
First, since your question is not programming related, I suggest you pose it again on the sister site serverfault.com. You might get more/better answers there.
Second, I do not think you will be able to remotely activate PXE on arbitrary machines. Maybe this works when you have Intel's AMT (Active Management Technology) on those machines, but then you already have BIOS access. But nevertheless you could activate PXE boot on all machines and from your PXE server, selectively offer boot images only to those machines you want to. All other machines would then just boot the installed OS. The FAI (Fully Automatic Install) system uses that approach, but is Linux only, AFAIK.
I agree with Dubu that reliable enable/disable of PXE boot in the BIOS across heterogeneous target hardware is not readily achievable. The better suggestion is to configure all your target machines to include PXE prior to local disk in their configured boot order always. You can PXE boot to something like PXELINUX and have the default choice be a local disk boot. Then you can selectively target particular machines to PXE boot into a network loaded OS (for OS reinstallation purposes) by configuring symlinks with the target machine's MAC address inside the PXELINUX TFTP root.

Resources