Skip to content

Commit

Permalink
add support for iso9660 and udf
Browse files Browse the repository at this point in the history
  • Loading branch information
zvin committed Mar 31, 2017
1 parent a2de02b commit 87efc09
Show file tree
Hide file tree
Showing 59 changed files with 19,618 additions and 13 deletions.
14 changes: 14 additions & 0 deletions defconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/linux-tmp/arch/lkl/defconfig b/linux-tmp/arch/lkl/defconfig
--- a/linux-tmp/arch/lkl/defconfig
+++ b/linux-tmp/arch/lkl/defconfig
@@ -33,6 +33,10 @@ CONFIG_XFS_FS=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_UDF_FS=y
# CONFIG_FILE_LOCKING is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
Binary file added test/fixtures/test.iso
Binary file not shown.
Binary file added test/fixtures/test.udf
Binary file not shown.
37 changes: 37 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ lkl.fs = Promise.promisifyAll(lkl.fs);
const RAW_FS_PATH = path.join(__dirname, 'fixtures/test.ext4');
const TMP_RAW_FS_PATH = path.join(__dirname, '.tmp-test.ext4');
const DISK_PATH = path.join(__dirname, 'fixtures/disk.img');
const ISO_FS_PATH = path.join(__dirname, 'fixtures/test.iso');
const UDF_FS_PATH = path.join(__dirname, 'fixtures/test.udf');

describe('node-lkl', function() {
it('should start the kernel', function() {
Expand Down Expand Up @@ -85,6 +87,41 @@ describe('node-lkl', function() {
});
});
});

describe('iso9660 image', function() {
before(function() {
this.disk = new lkl.disk.FileDisk(ISO_FS_PATH);
});

it('should mount', function() {
return lkl.mountAsync(this.disk, { readOnly: true, filesystem: 'iso9660'})
.then(lkl.umountAsync);
});
});

describe('udf image', function() {
before(function() {
this.disk = new lkl.disk.FileDisk(UDF_FS_PATH);
});

it('should mount', function() {
let mpoint;
return lkl.mountAsync(this.disk, { readOnly: true, filesystem: 'udf'})
.then(function(mp) {
mpoint = mp;
return lkl.fs.readdirAsync(mp);
})
.then(function(files) {
assert.deepEqual(
files.sort(),
[ 'lost+found', '┬──┬◡ノ(° -°ノ)' ]
)
})
.finally(function() {
return lkl.umountAsync(mpoint);
});
});
});
});

describe('fs', function() {
Expand Down
1 change: 1 addition & 0 deletions vendor.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -o errexit

git clone https://github.com/lkl/linux.git --depth=1 --branch master linux-tmp
git apply defconfig.patch

# Reset all access times to be in the past
find linux-tmp | xargs touch -a -d 2015-01-01
Expand Down
8 changes: 4 additions & 4 deletions vendor/linux/arch/lkl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ config LKL
select ARCH_THREAD_STACK_ALLOCATOR
select RWSEM_GENERIC_SPINLOCK
select GENERIC_ATOMIC64
select SEMAPHORE_SLEEPERS
select GENERIC_TIME
select GENERIC_FIND_NEXT_BIT
select GENERIC_HWEIGHT
select GENERIC_HARDIRQS
select FLATMEM
select FLAT_NODE_MEM_MAP
select GENERIC_CLOCKEVENTS
Expand All @@ -23,6 +19,10 @@ config LKL
select 64BIT if OUTPUT_FORMAT = "elf64-x86-64-freebsd"
select IP_PNP
select IP_PNP_DHCP
select TCP_CONG_BBR
select HIGH_RES_TIMERS
select NET_SCHED
select NET_SCH_FQ

config OUTPUTFORMAT
string
Expand Down
3 changes: 1 addition & 2 deletions vendor/linux/arch/lkl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ endif

LDFLAGS_vmlinux += -r
LKL_ENTRY_POINTS := lkl_start_kernel lkl_sys_halt lkl_syscall lkl_trigger_irq \
lkl_get_free_irq lkl_put_irq lkl_create_syscall_thread \
lkl_stop_syscall_thread lkl_is_running
lkl_get_free_irq lkl_put_irq lkl_is_running

core-y += arch/lkl/kernel/
core-y += arch/lkl/mm/
Expand Down
4 changes: 4 additions & 0 deletions vendor/linux/arch/lkl/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ CONFIG_XFS_FS=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=y
# CONFIG_FILE_LOCKING is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
Expand Down
2 changes: 0 additions & 2 deletions vendor/linux/arch/lkl/include/uapi/asm/host_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,10 @@ struct lkl_host_operations {
* The function returns only after the kernel is shutdown with lkl_sys_halt.
*
* @lkl_ops - pointer to host operations
* @mem_size - how much memory to allocate to the Linux kernel
* @cmd_line - format for command line string that is going to be used to
* generate the Linux kernel command line
*/
int lkl_start_kernel(struct lkl_host_operations *lkl_ops,
unsigned long mem_size,
const char *cmd_line, ...);

/**
Expand Down
1 change: 1 addition & 0 deletions vendor/linux/arch/lkl/include/uapi/asm/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ struct sockaddr {
#include <linux/virtio_blk.h>
#include <linux/virtio_net.h>
#include <linux/virtio_ring.h>
#include <linux/pkt_sched.h>

struct user_msghdr {
void __user *msg_name; /* ptr to socket address structure */
Expand Down
4 changes: 4 additions & 0 deletions vendor/linux/arch/lkl/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ static struct irq_info {

static bool irqs_enabled;

static struct pt_regs dummy;

static void run_irq(int irq)
{
unsigned long flags;
struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)&dummy);

/* interrupt handlers need to run with interrupts disabled */
local_irq_save(flags);
irq_enter();
generic_handle_irq(irq);
irq_exit();
set_irq_regs(old_regs);
local_irq_restore(flags);
}

Expand Down
12 changes: 9 additions & 3 deletions vendor/linux/arch/lkl/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,26 @@ static char cmd_line[COMMAND_LINE_SIZE];
static void *init_sem;
static int is_running;
void (*pm_power_off)(void) = NULL;
static unsigned long mem_size;
static unsigned long mem_size = 64 * 1024 * 1024;

long lkl_panic_blink(int state)
{
lkl_ops->panic();
return 0;
}

static int __init setup_mem_size(char *str)
{
mem_size = memparse(str, NULL);
return 0;
}
early_param("mem", setup_mem_size);

void __init setup_arch(char **cl)
{
*cl = cmd_line;
panic_blink = lkl_panic_blink;
parse_early_param();
bootmem_init(mem_size);
}

Expand All @@ -41,14 +49,12 @@ static void __init lkl_run_kernel(void *arg)
}

int __init lkl_start_kernel(struct lkl_host_operations *ops,
unsigned long _mem_size,
const char *fmt, ...)
{
va_list ap;
int ret;

lkl_ops = ops;
mem_size = _mem_size;

va_start(ap, fmt);
ret = vsnprintf(boot_command_line, COMMAND_LINE_SIZE, fmt, ap);
Expand Down
10 changes: 10 additions & 0 deletions vendor/linux/fs/isofs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Makefile for the Linux isofs filesystem routines.
#

obj-$(CONFIG_ISO9660_FS) += isofs.o

isofs-objs-y := namei.o inode.o dir.o util.o rock.o export.o
isofs-objs-$(CONFIG_JOLIET) += joliet.o
isofs-objs-$(CONFIG_ZISOFS) += compress.o
isofs-objs := $(isofs-objs-y)
Loading

0 comments on commit 87efc09

Please sign in to comment.