Linux no platform data

Docker on Mac M1 gives: «The requested image’s platform (linux/amd64) does not match the detected host platform»

After this line nothing else will happen anymore and the whole process is stuck, although the qemu-system-aarch64 is running on 100% CPU according to Activity Monitor until I press CTRL + C . My docker-files come from this repository. After running into the same issues there I tried to isolate the root cause and came up with the smallest setup that will run into the same error. This is the output of docker-compose up —build :

Building ganache Sending build context to Docker daemon 196.6kB Step 1/17 : FROM trufflesuite/ganache-cli:v6.9.1 ---> 40b011a5f8e5 Step 2/17 : LABEL Unlock ---> Using cache ---> aad8a72dac4e Step 3/17 : RUN apk add --no-cache git openssh bash ---> Using cache ---> 4ca6312438bd Step 4/17 : RUN apk add --no-cache python python-dev py-pip build-base && pip install virtualenv ---> Using cache ---> 0be290f541ed Step 5/17 : RUN npm install -g npm@6.4.1 ---> Using cache ---> d906d229a768 Step 6/17 : RUN npm install -g yarn ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested ---> Running in 991c1d804fdf 
version: '3.2' services: ganache: restart: always build: context: ./development dockerfile: ganache.dockerfile env_file: ../.env.dev.local ports: - 8545:8545 ganache-standup: image: ganache-standup build: context: ./development dockerfile: ganache.dockerfile env_file: ../.env.dev.local entrypoint: ['node', '/standup/prepare-ganache-for-unlock.js'] depends_on: - ganache 

ganache.dockerfile: The ganache.dockerfile can be found here. Running the whole project on an older iMac with Intel-processor works fine.

Источник

Platform Devices and Drivers¶

See for the driver model interface to the platform bus: platform_device, and platform_driver. This pseudo-bus is used to connect devices on busses with minimal infrastructure, like those used to integrate peripherals on many system-on-chip processors, or some «legacy» PC interconnects; as opposed to large formally specified ones like PCI or USB.

Platform devices¶

Platform devices are devices that typically appear as autonomous entities in the system. This includes legacy port-based devices and host bridges to peripheral buses, and most controllers integrated into system-on-chip platforms. What they usually have in common is direct addressing from a CPU bus. Rarely, a platform_device will be connected through a segment of some other kind of bus; but its registers will still be directly addressable.

Platform devices are given a name, used in driver binding, and a list of resources such as addresses and IRQs:

Platform drivers¶

Platform drivers follow the standard driver model convention, where discovery/enumeration is handled outside the drivers, and drivers provide probe() and remove() methods. They support power management and shutdown notifications using the standard conventions:

Читайте также:  Самый популярный линукс 2022

Note that probe() should in general verify that the specified device hardware actually exists; sometimes platform setup code can’t be sure. The probing can use device resources, including clocks, and device platform_data.

Platform drivers register themselves the normal way:

int platform_driver_register(struct platform_driver *drv);

Or, in common situations where the device is known not to be hot-pluggable, the probe() routine can live in an init section to reduce the driver’s runtime memory footprint:

int platform_driver_probe(struct platform_driver *drv, int (*probe)(struct platform_device *))

Kernel modules can be composed of several platform drivers. The platform core provides helpers to register and unregister an array of drivers:

int __platform_register_drivers(struct platform_driver * const *drivers, unsigned int count, struct module *owner); void platform_unregister_drivers(struct platform_driver * const *drivers, unsigned int count);

If one of the drivers fails to register, all drivers registered up to that point will be unregistered in reverse order. Note that there is a convenience macro that passes THIS_MODULE as owner parameter:

#define platform_register_drivers(drivers, count)

Device Enumeration¶

As a rule, platform specific (and often board-specific) setup code will register platform devices:

int platform_device_register(struct platform_device *pdev); int platform_add_devices(struct platform_device **pdevs, int ndev);

The general rule is to register only those devices that actually exist, but in some cases extra devices might be registered. For example, a kernel might be configured to work with an external network adapter that might not be populated on all boards, or likewise to work with an integrated controller that some boards might not hook up to any peripherals.

In some cases, boot firmware will export tables describing the devices that are populated on a given board. Without such tables, often the only way for system setup code to set up the correct devices is to build a kernel for a specific target board. Such board-specific kernels are common with embedded and custom systems development.

In many cases, the memory and IRQ resources associated with the platform device are not enough to let the device’s driver work. Board setup code will often provide additional information using the device’s platform_data field to hold additional information.

Embedded systems frequently need one or more clocks for platform devices, which are normally kept off until they’re actively needed (to save power). System setup also associates those clocks with the device, so that calls to clk_get(&pdev->dev, clock_name) return them as needed.

Legacy Drivers: Device Probing¶

Some drivers are not fully converted to the driver model, because they take on a non-driver role: the driver registers its platform device, rather than leaving that for system infrastructure. Such drivers can’t be hotplugged or coldplugged, since those mechanisms require device creation to be in a different system component than the driver.

The only «good» reason for this is to handle older system designs which, like original IBM PCs, rely on error-prone «probe-the-hardware» models for hardware configuration. Newer systems have largely abandoned that model, in favor of bus-level support for dynamic configuration (PCI, USB), or device tables provided by the boot firmware (e.g. PNPACPI on x86). There are too many conflicting options about what might be where, and even educated guesses by an operating system will be wrong often enough to make trouble.

Читайте также:  Oracle sql server for linux

This style of driver is discouraged. If you’re updating such a driver, please try to move the device enumeration to a more appropriate location, outside the driver. This will usually be cleanup, since such drivers tend to already have «normal» modes, such as ones using device nodes that were created by PNP or by platform device setup.

None the less, there are some APIs to support such legacy drivers. Avoid using these calls except with such hotplug-deficient drivers:

struct platform_device *platform_device_alloc( const char *name, int id);

You can use platform_device_alloc() to dynamically allocate a device, which you will then initialize with resources and platform_device_register() . A better solution is usually:

struct platform_device *platform_device_register_simple( const char *name, int id, struct resource *res, unsigned int nres);

You can use platform_device_register_simple() as a one-step call to allocate and register a device.

Device Naming and Driver Binding¶

The platform_device.dev.bus_id is the canonical name for the devices. It’s built from two components:

  • platform_device.name . which is also used to for driver matching.
  • platform_device.id . the device instance number, or else «-1» to indicate there’s only one.

These are concatenated, so name/id «serial»/0 indicates bus_id «serial.0», and «serial/3» indicates bus_id «serial.3»; both would use the platform_driver named «serial». While «my_rtc»/-1 would be bus_id «my_rtc» (no instance id) and use the platform_driver called «my_rtc».

Driver binding is performed automatically by the driver core, invoking driver probe() after finding a match between device and driver. If the probe() succeeds, the driver and device are bound as usual. There are three different ways to find such a match:

  • Whenever a device is registered, the drivers for that bus are checked for matches. Platform devices should be registered very early during system boot.
  • When a driver is registered using platform_driver_register(), all unbound devices on that bus are checked for matches. Drivers usually register later during booting, or by module loading.
  • Registering a driver using platform_driver_probe() works just like using platform_driver_register(), except that the driver won’t be probed later if another device registers. (Which is OK, since this interface is only for use with non-hotpluggable devices.)

Early Platform Devices and Drivers¶

The early platform interfaces provide platform data to platform device drivers early on during the system boot. The code is built on top of the early_param() command line parsing and can be executed very early on.

Example: «earlyprintk» class early serial console in 6 steps

1. Registering early platform device data¶

The architecture code registers platform device data using the function early_platform_add_devices(). In the case of early serial console this should be hardware configuration for the serial port. Devices registered at this point will later on be matched against early platform drivers.

2. Parsing kernel command line¶

The architecture code calls parse_early_param() to parse the kernel command line. This will execute all matching early_param() callbacks. User specified early platform devices will be registered at this point. For the early serial console case the user can specify port on the kernel command line as «earlyprintk=serial.0» where «earlyprintk» is the class string, «serial» is the name of the platform driver and 0 is the platform device id. If the id is -1 then the dot and the id can be omitted.

Читайте также:  Environment var in linux

3. Installing early platform drivers belonging to a certain class¶

The architecture code may optionally force registration of all early platform drivers belonging to a certain class using the function early_platform_driver_register_all(). User specified devices from step 2 have priority over these. This step is omitted by the serial driver example since the early serial driver code should be disabled unless the user has specified port on the kernel command line.

4. Early platform driver registration¶

Compiled-in platform drivers making use of early_platform_init() are automatically registered during step 2 or 3. The serial driver example should use early_platform_init(«earlyprintk», &platform_driver).

5. Probing of early platform drivers belonging to a certain class¶

The architecture code calls early_platform_driver_probe() to match registered early platform devices associated with a certain class with registered early platform drivers. Matched devices will get probed(). This step can be executed at any point during the early boot. As soon as possible may be good for the serial port case.

6. Inside the early platform driver probe()¶

The driver code needs to take special care during early boot, especially when it comes to memory allocation and interrupt registration. The code in the probe() function can use is_early_platform_device() to check if it is called at early platform device or at the regular platform device time. The early serial driver performs register_console() at this point.

Источник

How to define platform_data in a Linux 3.8 device tree structure (DTS) file

I’m trying to get the at86rf230 kernel driver running on a BeagleBone Black to communicate with my radio. I have confirmed that I am able to interact with the device using some userspace SPI code. Here’s the fragment of the DTS file I’m working with:

fragment@0 < target = ; __overlay__ < spi1_pins_s0: spi1_pins_s0 < pinctrl-single,pins = < 0x040 0x37 /* DIG2 GPIO_9.15 I_PULLUP | MODE7-GPIO1_16 */ 0x044 0x17 /* SLPTR GPIO_9.23 O_PULLUP | MODE7-GPIO1_17 */ 0x1AC 0x17 /* RSTN GPIO_9.25 O_PULLUP | MODE7-GPIO3_21 */ 0x1A4 0x37 /* IRQ GPIO_9.26 I_PULLUP | MODE7-GPIO3_19 */ 0x190 0x33 /* SCLK mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ 0x194 0x33 /* MISO mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ 0x198 0x13 /* MOSI mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */ 0x19c 0x13 /* SCS0 mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ >; >; >; >; fragment@3 < target = ; __overlay__ < #address-cells = ; #size-cells = ; status = "okay"; pinctrl-names = "default"; pinctrl-0 = ; at86rf230@0 < spi-max-frequency = ; reg = ; compatible = "at86rf230"; interrupts = ; interrupt-parent = ; >; >; >; 
[ 352.668833] at86rf230 spi1.0: no platform_data [ 352.668945] at86rf230: probe of spi1.0 failed with error -22 

I am trying to work out the right way to attach platform_data to the SPI overlay. Here’s what I’d like to attach:

platform_data < rstn = ; slp_tr = ; dig2 = ; >; 

Unfortunately, just sticking it in as-is doesn’t work so well when I use dtc to compile the DTS. I get the following error:

syntax error: properties must precede subnodes FATAL ERROR: Unable to parse input tree 

I feel that I’m ridiculously close to solving this, and I just need a little shove in the right direction 😉

Источник

Оцените статью
Adblock
detector