Commit 2d55c00d authored by Anton Burtsev's avatar Anton Burtsev Committed by Vikram Narayanan
Browse files

Clean up user-level includes, build inskern4lcd tool

It took me a while to figure out a suggested layout for Linux
user-visible headers. I ended up with this:

  ./include/lcd/lcd.h -- includes #include <uapi/linux/lcd.h>
  ./include/uapi/linux/lcd.h -- this file will be installed to
      /usr/linux/lcd.h

Note on installing user-visible header files

 1) Add header-y += lcd.h line to include/uapi/linux/Kbuild

 2) Install sanitized header files into ./usr/include

    sudo make install_headers

 3) Copy ./usr/include to /usr/include

    sudo find usr/include \( -name .install -o -name ..install.cmd \) -delete
    sudo cp -rv usr/include/* /usr/include
parent 552bd976
......@@ -2,8 +2,8 @@
#define LCD_LCD_H
#include <asm/vmx.h>
#include <lcd/ipc.h>
#include <uapi/linux/lcd.h>
/* XXX: arch dependent, move to ./arch/x86/lcd */
#define NR_AUTOLOAD_MSRS 8
......
......@@ -246,6 +246,7 @@ header-y += hw_breakpoint.h
header-y += l2tp.h
header-y += libc-compat.h
header-y += lirc.h
header-y += lcd.h
header-y += limits.h
header-y += llc.h
header-y += loop.h
......
/*
* lcd.h - public header for LCD support
* lcd.h - interface to LCD domains
*
* Author: Anton Burtsev
*/
#include <linux/types.h>
#ifndef __LINUX_PUBLIC_LCD_H__
#define __LINUX_PUBLIC_LCD_H__
/*
* IOCTL interface
*/
......@@ -17,3 +19,4 @@ struct lcd_pv_kernel_config {
char *file;
} __attribute__((packed));
#endif /* __LINUX_PUBLIC_LCD_H__ */
insmod4lcd
inskern4lcd
# Userspace tools
# LCD tools
CFLAGS=-O2
#CFLAGS += -O2
CC = $(CROSS_COMPILE)gcc
CFLAGS = -Wall -Wextra
TOOLS = insmod4lcd
TOOLS = insmod4lcd inskern4lcd
all: $(TOOLS)
insmod4lcd: insmod4lcd.c
gcc $(CFLAGS) $^ -o $@
inskern4lcd: inskern4lcd.c
gcc $(CFLAGS) $^ -o $@
clean:
rm -f $(TOOLS)
$(RM) -f $(TOOLS)
......@@ -28,8 +28,10 @@
#include <unistd.h>
#include <errno.h>
#include <asm/unistd.h>
#include <sys/ioctl.h>
#include <linux/lcd.h>
//extern long init_lcd(void *, unsigned long, const char *);
extern long init_module(void *, unsigned long, const char *);
static char *my_basename(const char *path)
{
......@@ -113,9 +115,12 @@ int main(int argc, char *argv[])
unsigned int i;
long int ret;
unsigned long len;
int fd;
void *file;
char *filename, *options = strdup("");
char *p, *progname = argv[0];
struct lcd_pv_kernel_config conf;
if (!options) {
fprintf(stderr,
......@@ -163,8 +168,15 @@ int main(int argc, char *argv[])
filename, strerror(errno));
exit(1);
}
// printf("gets to call");
ret = syscall(314, file, len, options);
fd = open("/dev/lcd", 0);
if (fd < 0) {
printf("Can't open device file: %s\n", "/dev/lcd");
exit(-1);
}
conf.file = filename;
ret = ioctl(fd, LCD_LOAD_PV_KERNEL, &conf);
if (ret != 0) {
fprintf(stderr, "insmod: error inserting '%s': %li %s\n",
filename, ret, moderror(errno));
......
......@@ -28,9 +28,6 @@
#include <unistd.h>
#include <errno.h>
#include <asm/unistd.h>
extern long init_module(void *, unsigned long, const char *);
static char *my_basename(const char *path)
{
const char *base = strrchr(path, '/');
......@@ -163,8 +160,8 @@ int main(int argc, char *argv[])
filename, strerror(errno));
exit(1);
}
ret = init_module(file, len, options);
// printf("gets to call");
ret = syscall(314, file, len, options);
if (ret != 0) {
fprintf(stderr, "insmod: error inserting '%s': %li %s\n",
filename, ret, moderror(errno));
......
......@@ -14,7 +14,6 @@
#include <linux/compat.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/lcd-domains.h>
#include <lcd/lcd.h>
MODULE_LICENSE("GPL");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment