I would like to support two similar hardware platforms with one embedded Linux kernel. Does the kernel support multiple struct machine_desc structures? Instances of this structure are usually defined by using the MACHINE_START and MACHINE_END macros in the board’s C definition file.
There is a mechanism to pass the MACH_TYPE from the bootloader to the kernel so it seems to make sense that the kernel can support multiple machines. Does anything special need to be done?
I spent some time looking at the kernel code (version 2.6.33) and the ARM architecture supports multiple machines in the same kernel. However I am not sure if other architectures do. Here’s how it works
CONFIG_MACH_TYPE_*values need to be set in the configuration file. When built, the kernel will then generate the all the machine macros based on the version of mach-types included with the source. The source code for machine definitions will also be compiled into the kernel.r1before starting the kernel.r1to__lookup_machine_typeto find the machine definition and initializes the board.