Compare commits
14 changed files with 124 additions and 169 deletions
|
|
@ -3,14 +3,10 @@
|
||||||
#define _SPINLOCK_H_
|
#define _SPINLOCK_H_
|
||||||
|
|
||||||
#include <kernel/types.h>
|
#include <kernel/types.h>
|
||||||
#include <kernel/common.h>
|
|
||||||
|
|
||||||
#define CLEANUP_SLOCK CLEANUP(cleanup_spinlock)
|
|
||||||
|
|
||||||
typedef u32 spinlock_t;
|
typedef u32 spinlock_t;
|
||||||
|
|
||||||
void spinlock_acquire(spinlock_t *lock);
|
void spinlock_acquire(spinlock_t *lock);
|
||||||
void spinlock_release(spinlock_t *lock);
|
void spinlock_release(spinlock_t *lock);
|
||||||
void cleanup_spinlock(spinlock_t **lock_ptr);
|
|
||||||
|
|
||||||
#endif /* _SPINLOCK_H_ */
|
#endif /* _SPINLOCK_H_ */
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,3 @@ void spinlock_release(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
atomic_cmpxchg(lock, 1, 0);
|
atomic_cmpxchg(lock, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup_spinlock(spinlock_t **lock_ptr)
|
|
||||||
{
|
|
||||||
if (lock_ptr && *lock_ptr)
|
|
||||||
spinlock_release(*lock_ptr);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
#include <kernel/common.h>
|
|
||||||
#include <fs/dcache.h>
|
|
||||||
#include <fs/inode.h>
|
|
||||||
#include <lib/string.h>
|
|
||||||
|
|
||||||
#define DC_TOMBSTONE ((struct dc_entry *)1)
|
|
||||||
|
|
||||||
struct dc_entry dcache[DCACHE_SIZE];
|
|
||||||
static spinlock_t dcache_locks[DCACHE_NLOCKS];
|
|
||||||
|
|
||||||
static unsigned long dcache_hash(struct dc_entry *parent, const char *name)
|
|
||||||
{
|
|
||||||
unsigned long h = (unsigned long)parent;
|
|
||||||
while (*name)
|
|
||||||
h = ((h << 5) - h) + (unsigned char)*name++;
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
static spinlock_t *dcache_lock_for(struct dc_entry *parent, const char *name)
|
|
||||||
{
|
|
||||||
unsigned long h = dcache_hash(parent, name);
|
|
||||||
return &dcache_locks[h & (DCACHE_NLOCKS - 1)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void dcache_init(void)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < DCACHE_SIZE; i++)
|
|
||||||
dcache[i].parent = NULL;
|
|
||||||
for (int i = 0; i < DCACHE_NLOCKS; i++)
|
|
||||||
dcache_locks[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dcache_insert(struct dc_entry *parent, dirent_t *dirent, const char *name)
|
|
||||||
{
|
|
||||||
spinlock_t *lock = dcache_lock_for(parent, name);
|
|
||||||
unsigned long h = dcache_hash(parent, name);
|
|
||||||
|
|
||||||
spinlock_acquire(lock);
|
|
||||||
for (int i = 0; i < DCACHE_SIZE; i++) {
|
|
||||||
unsigned int b = (h + i) & (DCACHE_SIZE - 1);
|
|
||||||
struct dc_entry *s = &dcache[b];
|
|
||||||
|
|
||||||
if (!s->parent || s->parent == DC_TOMBSTONE || s->dirent->refcount == 0) {
|
|
||||||
if (s->dirent)
|
|
||||||
dirent_free(s->dirent);
|
|
||||||
s->parent = parent;
|
|
||||||
s->dirent = dirent;
|
|
||||||
memcpy(s->d_name, name, FILE_NAME_MAX_LEN + 1);
|
|
||||||
spinlock_release(lock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spinlock_release(lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dcache_remove(struct dc_entry *d)
|
|
||||||
{
|
|
||||||
spinlock_t *lock = dcache_lock_for(d->parent, d->d_name);
|
|
||||||
|
|
||||||
spinlock_acquire(lock);
|
|
||||||
dirent_free(d->dirent);
|
|
||||||
d->dirent = NULL;
|
|
||||||
d->parent = DC_TOMBSTONE;
|
|
||||||
spinlock_release(lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct dc_entry *dcache_lookup(struct dc_entry *parent, const char *name)
|
|
||||||
{
|
|
||||||
spinlock_t *lock = dcache_lock_for(parent, name);
|
|
||||||
unsigned long h = dcache_hash(parent, name);
|
|
||||||
struct dc_entry *result = NULL;
|
|
||||||
|
|
||||||
spinlock_acquire(lock);
|
|
||||||
for (int i = 0; i < DCACHE_SIZE; i++) {
|
|
||||||
unsigned int b = (h + i) & (DCACHE_SIZE - 1);
|
|
||||||
struct dc_entry *s = &dcache[b];
|
|
||||||
|
|
||||||
if (!s->parent)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (s->parent != DC_TOMBSTONE && s->parent == parent && !strcmp(s->d_name, name)) {
|
|
||||||
result = s;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out:
|
|
||||||
spinlock_release(lock);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
109
fs/vfs/mount.c
109
fs/vfs/mount.c
|
|
@ -40,6 +40,15 @@ struct mount *mount_find_child(struct mount *parent, dirent_t *dent)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int load_inode(dirent_t *dent)
|
||||||
|
{
|
||||||
|
if (dent->inode)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int res = dent->fs->fs_ops.open_inode(dent->fs, dent->ino_num, dent, &dent->inode);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int mount_traverse(const char *path, struct mount **out_mount, dirent_t **out_dirent)
|
static int mount_traverse(const char *path, struct mount **out_mount, dirent_t **out_dirent)
|
||||||
{
|
{
|
||||||
if (!root_mount)
|
if (!root_mount)
|
||||||
|
|
@ -56,7 +65,88 @@ static int mount_traverse(const char *path, struct mount **out_mount, dirent_t *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vfs_openat(root_mount, root_mount->fs->root_dirent, path, out_dirent, out_mount, false);
|
struct mount *cur = root_mount;
|
||||||
|
dirent_t *cur_dent = root_mount->fs->root_dirent;
|
||||||
|
|
||||||
|
if (!cur_dent)
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
|
dirent_inc_ref(cur_dent);
|
||||||
|
|
||||||
|
const char *p = path;
|
||||||
|
|
||||||
|
while (*p != '\0') {
|
||||||
|
const char *comp_start = p;
|
||||||
|
while (*p != '/' && *p != '\0')
|
||||||
|
p++;
|
||||||
|
|
||||||
|
size_t comp_len = p - comp_start;
|
||||||
|
if (comp_len > FILE_NAME_MAX_LEN) {
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
return -ENAMETOOLONG;
|
||||||
|
}
|
||||||
|
|
||||||
|
char name[FILE_NAME_MAX_LEN + 1];
|
||||||
|
memcpy(name, comp_start, comp_len);
|
||||||
|
name[comp_len] = '\0';
|
||||||
|
|
||||||
|
while (*p == '/')
|
||||||
|
p++;
|
||||||
|
|
||||||
|
bool is_last = (*p == '\0');
|
||||||
|
|
||||||
|
dirent_t *found = NULL;
|
||||||
|
int res = dirent_lookup(cur_dent, name, &found);
|
||||||
|
if (res < 0) {
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = load_inode(found);
|
||||||
|
if (res < 0) {
|
||||||
|
dirent_dec_ref(found);
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_last) {
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
*out_mount = cur;
|
||||||
|
*out_dirent = found;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct mount *child = NULL;
|
||||||
|
list_item_t *item = cur->children.head;
|
||||||
|
while (item) {
|
||||||
|
struct mount *m = item->ptr;
|
||||||
|
if (m->mountpoint == found) {
|
||||||
|
child = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item = item->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
|
||||||
|
if (child) {
|
||||||
|
dirent_dec_ref(found);
|
||||||
|
cur = child;
|
||||||
|
cur_dent = cur->fs->root_dirent;
|
||||||
|
if (!cur_dent)
|
||||||
|
return -ENOENT;
|
||||||
|
dirent_inc_ref(cur_dent);
|
||||||
|
} else {
|
||||||
|
cur_dent = found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dirent_dec_ref(cur_dent);
|
||||||
|
*out_mount = cur;
|
||||||
|
*out_dirent = cur->fs->root_dirent;
|
||||||
|
if (*out_dirent)
|
||||||
|
dirent_inc_ref(*out_dirent);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfs_mount(const char *path, fs_t *fs, u64 flags)
|
int vfs_mount(const char *path, fs_t *fs, u64 flags)
|
||||||
|
|
@ -64,9 +154,9 @@ int vfs_mount(const char *path, fs_t *fs, u64 flags)
|
||||||
if (!fs)
|
if (!fs)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
spinlock_acquire(&mount_lock);
|
spinlock_acquire(&mount_lock);
|
||||||
|
|
||||||
|
if (!path) {
|
||||||
if (root_mount) {
|
if (root_mount) {
|
||||||
spinlock_release(&mount_lock);
|
spinlock_release(&mount_lock);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
@ -93,16 +183,17 @@ int vfs_mount(const char *path, fs_t *fs, u64 flags)
|
||||||
struct mount *parent = NULL;
|
struct mount *parent = NULL;
|
||||||
dirent_t *mp = NULL;
|
dirent_t *mp = NULL;
|
||||||
int res = mount_traverse(path, &parent, &mp);
|
int res = mount_traverse(path, &parent, &mp);
|
||||||
if (res < 0)
|
if (res < 0) {
|
||||||
|
spinlock_release(&mount_lock);
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if ((mp->inode->mode & S_IFMT) != S_IFDIR) {
|
if ((mp->inode->mode & S_IFMT) != S_IFDIR) {
|
||||||
dirent_dec_ref(mp);
|
dirent_dec_ref(mp);
|
||||||
|
spinlock_release(&mount_lock);
|
||||||
return -ENOTDIR;
|
return -ENOTDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
spinlock_acquire(&mount_lock);
|
|
||||||
|
|
||||||
list_item_t *item = parent->children.head;
|
list_item_t *item = parent->children.head;
|
||||||
while (item) {
|
while (item) {
|
||||||
struct mount *m = item->ptr;
|
struct mount *m = item->ptr;
|
||||||
|
|
@ -145,13 +236,15 @@ int vfs_umount(const char *path)
|
||||||
if (!path)
|
if (!path)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
spinlock_acquire(&mount_lock);
|
||||||
|
|
||||||
struct mount *parent = NULL;
|
struct mount *parent = NULL;
|
||||||
dirent_t *mp = NULL;
|
dirent_t *mp = NULL;
|
||||||
int res = mount_traverse(path, &parent, &mp);
|
int res = mount_traverse(path, &parent, &mp);
|
||||||
if (res < 0)
|
if (res < 0) {
|
||||||
|
spinlock_release(&mount_lock);
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
spinlock_acquire(&mount_lock);
|
|
||||||
|
|
||||||
struct mount *target = NULL;
|
struct mount *target = NULL;
|
||||||
list_item_t *item = parent->children.head;
|
list_item_t *item = parent->children.head;
|
||||||
|
|
|
||||||
24
fs/vfs/vfs.c
24
fs/vfs/vfs.c
|
|
@ -84,7 +84,7 @@ static int next_level(const char *path, dirent_t *dent, dirent_t **out_dirent)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out, struct mount **out_mnt, bool follow)
|
int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out)
|
||||||
{
|
{
|
||||||
if (!in || !name || !out)
|
if (!in || !name || !out)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -99,8 +99,6 @@ int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out
|
||||||
|
|
||||||
if (*path_optr == '\0') {
|
if (*path_optr == '\0') {
|
||||||
*out = current_dir;
|
*out = current_dir;
|
||||||
if (out_mnt)
|
|
||||||
*out_mnt = mnt;
|
|
||||||
kfree(path_optr);
|
kfree(path_optr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -121,15 +119,8 @@ int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out
|
||||||
dirent_dec_ref(current_dir);
|
dirent_dec_ref(current_dir);
|
||||||
current_dir = next_dir;
|
current_dir = next_dir;
|
||||||
|
|
||||||
cur_path += res;
|
|
||||||
|
|
||||||
while (*cur_path == '/')
|
|
||||||
cur_path++;
|
|
||||||
|
|
||||||
bool at_end = (*cur_path == '\0');
|
|
||||||
|
|
||||||
struct mount *child = mount_find_child(cur_mount, current_dir);
|
struct mount *child = mount_find_child(cur_mount, current_dir);
|
||||||
if (child && (!at_end || follow)) {
|
if (child) {
|
||||||
dirent_dec_ref(current_dir);
|
dirent_dec_ref(current_dir);
|
||||||
cur_mount = child;
|
cur_mount = child;
|
||||||
current_dir = child->fs->root_dirent;
|
current_dir = child->fs->root_dirent;
|
||||||
|
|
@ -140,10 +131,13 @@ int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out
|
||||||
dirent_inc_ref(current_dir);
|
dirent_inc_ref(current_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (at_end) {
|
cur_path += res;
|
||||||
|
|
||||||
|
while (*cur_path == '/')
|
||||||
|
cur_path++;
|
||||||
|
|
||||||
|
if (*cur_path == '\0') {
|
||||||
*out = current_dir;
|
*out = current_dir;
|
||||||
if (out_mnt)
|
|
||||||
*out_mnt = cur_mount;
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +157,7 @@ int vfs_open(const char *abs_path, dirent_t **out)
|
||||||
if (!root || !root->fs || !root->fs->root_dirent)
|
if (!root || !root->fs || !root->fs->root_dirent)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
return vfs_openat(root, root->fs->root_dirent, abs_path, out, NULL, true);
|
return vfs_openat(root, root->fs->root_dirent, abs_path, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfs_close(dirent_t *dent)
|
void vfs_close(dirent_t *dent)
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
#ifndef _DCACHE_H_
|
|
||||||
#define _DCACHE_H_
|
|
||||||
|
|
||||||
#include <kernel/spinlock.h>
|
|
||||||
#include <fs/vfs.h>
|
|
||||||
|
|
||||||
#include <lib/list.h>
|
|
||||||
|
|
||||||
#define DCACHE_SHIFT 10
|
|
||||||
#define DCACHE_SIZE (1 << DCACHE_SHIFT)
|
|
||||||
|
|
||||||
#define DCACHE_LOCK_SHIFT 4
|
|
||||||
#define DCACHE_NLOCKS (1 << DCACHE_LOCK_SHIFT)
|
|
||||||
|
|
||||||
struct dc_entry {
|
|
||||||
struct dc_entry *parent;
|
|
||||||
struct mount *mount;
|
|
||||||
spinlock_t lock;
|
|
||||||
list_t children;
|
|
||||||
dirent_t *dirent;
|
|
||||||
char d_name[FILE_NAME_MAX_LEN + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct dc_entry dcache[DCACHE_SIZE];
|
|
||||||
|
|
||||||
void dcache_init(void);
|
|
||||||
void dcache_insert(struct dc_entry *parent, dirent_t *dirent, const char *name);
|
|
||||||
void dcache_remove(struct dc_entry *d);
|
|
||||||
struct dc_entry *dcache_lookup(struct dc_entry *parent, const char *name);
|
|
||||||
|
|
||||||
#endif /* _DCACHE_H_ */
|
|
||||||
|
|
@ -107,7 +107,7 @@ void vfs_init(void);
|
||||||
void vfs_register(struct fs_driver *fs);
|
void vfs_register(struct fs_driver *fs);
|
||||||
|
|
||||||
int vfs_open(const char *abs_path, dirent_t **out);
|
int vfs_open(const char *abs_path, dirent_t **out);
|
||||||
int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out, struct mount **out_mnt, bool follow);
|
int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out);
|
||||||
void vfs_close(dirent_t *dent);
|
void vfs_close(dirent_t *dent);
|
||||||
int vfs_readdir(dirent_t *dir, struct dir_context *ctx, dirent_t **out);
|
int vfs_readdir(dirent_t *dir, struct dir_context *ctx, dirent_t **out);
|
||||||
int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t **out);
|
int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t **out);
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@
|
||||||
#define DRIVER_ENTRY(fn) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall"))) = fn
|
#define DRIVER_ENTRY(fn) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall"))) = fn
|
||||||
#define DRIVER_ENTRY_PRIORITY(fn, pr) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall." #pr))) = fn
|
#define DRIVER_ENTRY_PRIORITY(fn, pr) static void (*__initcall_##fn)(void) __attribute((used, section(".initcall." #pr))) = fn
|
||||||
|
|
||||||
#define CLEANUP(fn) __attribute__((__cleanup__(fn)))
|
|
||||||
|
|
||||||
void yield();
|
void yield();
|
||||||
void _panic();
|
void _panic();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#define ALLOC_KERN 0x1
|
#define ALLOC_KERN 0x1
|
||||||
#define ALLOC_USER 0x2
|
#define ALLOC_USER 0x2
|
||||||
|
|
||||||
#define CLEANUP_KFREE CLEANUP(cleanup_kfree)
|
#define CLEANUP_KFREE __attribute__((cleanup(_cleanup_kfree)))
|
||||||
|
|
||||||
typedef struct _mem_cache_t {
|
typedef struct _mem_cache_t {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
@ -31,7 +31,6 @@ void *kalloc(size_t size, u64 flags);
|
||||||
void *kzalloc(size_t size, u64 flags);
|
void *kzalloc(size_t size, u64 flags);
|
||||||
void *krealloc(void *old, size_t size, u64 flags);
|
void *krealloc(void *old, size_t size, u64 flags);
|
||||||
void kfree(void *ptr);
|
void kfree(void *ptr);
|
||||||
void cleanup_kfree(void **ptr);
|
|
||||||
|
|
||||||
void kalloc_init();
|
void kalloc_init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#ifndef _ERRNO_H_
|
#ifndef _ERRNO_H_
|
||||||
#define _ERRNO_H_
|
#define _ERRNO_H_
|
||||||
|
|
||||||
|
|
||||||
#define ENOMEM 1
|
#define ENOMEM 1
|
||||||
#define ENOENT 2
|
#define ENOENT 2
|
||||||
#define EINVAL 3
|
#define EINVAL 3
|
||||||
|
|
@ -15,10 +16,10 @@
|
||||||
#define EAGAIN 11
|
#define EAGAIN 11
|
||||||
#define EIO 12
|
#define EIO 12
|
||||||
#define EBUSY 13
|
#define EBUSY 13
|
||||||
#define ENOSYS 14
|
#define ENOSYS 13
|
||||||
#define ESYSCALLBLK 15
|
#define ESYSCALLBLK 14
|
||||||
#define ENAMETOOLONG 16
|
#define ENAMETOOLONG 15
|
||||||
#define EROFS 17
|
#define EROFS 16
|
||||||
|
|
||||||
#ifndef __ASM__
|
#ifndef __ASM__
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ void slab_free(mem_cache_t *cache, void *ptr)
|
||||||
spinlock_release(&cache->lock);
|
spinlock_release(&cache->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup_kfree(void **ptr)
|
void _cleanup_kfree(void **ptr)
|
||||||
{
|
{
|
||||||
if (ptr && *ptr)
|
if (ptr && *ptr)
|
||||||
kfree(ptr);
|
kfree(ptr);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ limine/limine:
|
||||||
|
|
||||||
$(INITRAMFS): initramfs/
|
$(INITRAMFS): initramfs/
|
||||||
$(Q)echo " CPIO $@"
|
$(Q)echo " CPIO $@"
|
||||||
$(Q)mkdir -p initramfs/dev
|
$(Q)mkdir -p initramfs/
|
||||||
$(Q)cd initramfs/ && find . | cpio -oH newc > ../$(INITRAMFS)
|
$(Q)cd initramfs/ && find . | cpio -oH newc > ../$(INITRAMFS)
|
||||||
|
|
||||||
.PHONY += run
|
.PHONY += run
|
||||||
|
|
@ -46,6 +46,7 @@ run: edk2-ovmf $(IMG)
|
||||||
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
||||||
-accel kvm \
|
-accel kvm \
|
||||||
-hda $(IMG) \
|
-hda $(IMG) \
|
||||||
|
-hdb test_drive.hdd \
|
||||||
-nographic \
|
-nographic \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
$(QEMUFLAGS)
|
$(QEMUFLAGS)
|
||||||
|
|
@ -57,6 +58,7 @@ debug: edk2-ovmf $(IMG)
|
||||||
-M q35 \
|
-M q35 \
|
||||||
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
||||||
-hda $(IMG) \
|
-hda $(IMG) \
|
||||||
|
-hdb test_drive.hdd \
|
||||||
-nographic \
|
-nographic \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
$(QEMUFLAGS)
|
$(QEMUFLAGS)
|
||||||
|
|
|
||||||
2
usr.bin/init/.gitignore
vendored
2
usr.bin/init/.gitignore
vendored
|
|
@ -1 +1 @@
|
||||||
init
|
utest
|
||||||
|
|
|
||||||
BIN
usr.bin/init/init
Executable file
BIN
usr.bin/init/init
Executable file
Binary file not shown.
Loading…
Reference in a new issue