使用方式  makedevs -r <rootfs>  -D <需要创建的设备文件文本>

其中rootfs需要绝对路径

例如:

sudo makedevs -r $(pwd)/test    -D  /usr/share/makedevs/device_table-minimal.txt


---------------------------------以下是PKGBUILD文件内容-----------------------


# Contributor: GunsNRose <zlbgps AT gmail.com>>
pkgname=makedevs
pkgver=1.0
pkgrel=1
pkgdesc="openembedded make device nodes"
arch=('i686' 'x86_64')
url="http://www.openembedded.org"
license=('GPL')
source=("makedevs.c"
"device_table-minimal.txt")
#depends=('oe')
build() {
    cd $srcdir
    gcc -o makedevs makedevs.c
}
package() {
    cd $srcdir
  install -d -Dm755 $pkgdir/usr/bin
  install -d -Dm755 $pkgdir/usr/share/makedevs
  install -Dm755 makedevs $pkgdir/usr/bin/makedevs
  install -Dm644 device_table-minimal.txt  $pkgdir/usr/share/makedevs/device_table-minimal.txt
}
md5sums=('c04eb933088040258875b723c8a6c333'
         '61d9d46f9caa6116b8f9ee14c7cd240c')

=====================================

makedevs.c

#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <time.h>
#include <getopt.h>
#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>
#define MINORBITS8
#define MKDEV(ma,mi)(((ma) << MINORBITS) | (mi))
/* These are all stolen from busybox's libbb to make
 * error handling simpler (and since I maintain busybox,
 * I'm rather partial to these for error handling).
 *  -Erik
 */
static const char *const app_name = "makedevs";
static const char *const memory_exhausted = "memory exhausted";
static char default_rootdir[]=".";
static char *rootdir = default_rootdir;
static void verror_msg(const char *s, va_list p)
{
fflush(stdout);
fprintf(stder