Commit 5ccadeae authored by 张雪芹's avatar 张雪芹
Browse files

add oscourse shiyan1

parent 82ea5be5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
DISTRO_NAME = "PolyOS"
DISTRO_VERSION = "PolyOS.1.0"

conf/layer.conf

0 → 100644
+16 −0
Original line number Diff line number Diff line
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-oscourse"
BBFILE_PATTERN_meta-oscourse = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-oscourse = "8"
LAYERVERSION_meta-oscourse = "1"
LAYERDEPENDS_meta-oscourse = "core"
LAYERSERIES_COMPAT_meta-oscourse = "honister"
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "hello"    
KERNEL_MODULE_AUTOLOAD += "hello"

hello/files/Makefile

0 → 100644
+11 −0
Original line number Diff line number Diff line
obj-m += hello.o

SRC := $(shell pwd)

KERNEL_SRC := $(shell pwd)/../../../../../work-shared/qemuriscv64/kernel-source
all:
	make -C  $(KERNEL_SRC) ARCH=riscv M=$(SRC) modules

clean:
	make -C $(KERNEL_SRC) ARCH=riscv M=$(SRC) clean

hello/files/hello.c

0 → 100644
+32 −0
Original line number Diff line number Diff line
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
 
/*
 * hello_init ---初始化函数,当模块装载时被调用,如果成功返回 0,否则返回非0值
 *
 */
 
 
static int __init hello_init(void){
 
	printk(KERN_ALERT"hello kernel.\n");
	return 0;
}
 
/*
 * hello_exit ---退出函数,当模块卸载时被调用
 *
 */
 
static void __exit hello_exit(void){
 
	printk(KERN_ALERT"exit kernel.\n");
 
}
 
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("Dual BSD/GPL");

hello/hello_0.1.bb

0 → 100644
+26 −0
Original line number Diff line number Diff line
LICENSE = "CLOSED"

SRC_URI = "file://hello.c \
           file://Makefile \
         "

inherit module 

do_copy_files () {
  echo  $WORKDIR
  cp  -f ${WORKDIR}/hello.c ${WORKDIR}/hello-0.1/
  cp  -f ${WORKDIR}/Makefile ${WORKDIR}/hello-0.1/
}
addtask do_copy_files after do_configure before do_compile 

do_compile() { 
  echo $WORKDIR
  make
}

do_install(  ){
  install -d ${D}/lib/modules/${KERNEL_VERSION}
  cd  ${WORKDIR}/hello-0.1/
  install -m 0644 hello.ko ${D}/lib/modules/${KERNEL_VERSION}
}