Buildroot QEMU works. Nuff said.

This commit is contained in:
Ciro Santilli
2017-05-11 07:28:35 +01:00
parent 338756a029
commit e06171b483
10 changed files with 102 additions and 7 deletions

1
kernel_module/Config.in Normal file
View File

@@ -0,0 +1 @@
source "$BR2_EXTERNAL_KERNEL_MODULE_PATH/package/kernel_module/Config.in"

View File

@@ -0,0 +1 @@
name: KERNEL_MODULE

View File

@@ -0,0 +1 @@
include $(sort $(wildcard $(BR2_EXTERNAL_KERNEL_MODULE_PATH)/package/*/*.mk))

View File

@@ -0,0 +1,5 @@
config BR2_PACKAGE_KERNEL_MODULE
bool "kernel_module"
depends on BR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.

View File

@@ -0,0 +1,20 @@
################################################################################
#
# kernel_module
#
################################################################################
KERNEL_MODULE_VERSION = 1.0
KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_PATH)/package/kernel_module/src
KERNEL_MODULE_SITE_METHOD = local
define KERNEL_MODULE_BUILD_CMDS
$(MAKE) -C '$(@D)' LINUX_DIR='$(LINUX_DIR)' PWD='$(@D)' CC='$(TARGET_CC)' LD='$(TARGET_LD)'
endef
define KERNEL_MODULE_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/*.ko '$(TARGET_DIR)'
endef
$(eval $(kernel-module))
$(eval $(generic-package))

View File

@@ -0,0 +1,10 @@
obj-m += hello.o hello2.o
ccflags-y := -Wno-declaration-after-statement -std=gnu99
.PHONY: all clean
all:
$(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' modules
clean:
$(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' clean

View File

@@ -0,0 +1,17 @@
/*
Hello world module.
*/
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "hello init\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "hello cleanup\n");
}

View File

@@ -0,0 +1,19 @@
/*
Hello world module 2.
Mostly to check that our build infrastructure can handle more than one module!
*/
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "hello2 init\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "hello2 cleanup\n");
}