Add ucore & xv6-x86_64 user program img file.

master
WangRunji 7 years ago
parent 859b3891c1
commit 2867ae60b6

@ -10,7 +10,8 @@ grub_cfg := $(boot_src)/grub.cfg
assembly_source_files := $(wildcard $(boot_src)/*.asm)
assembly_object_files := $(patsubst $(boot_src)/%.asm, \
build/arch/$(arch)/boot/%.o, $(assembly_source_files))
user_object_files := $(wildcard user/*.o)
user_image_files := $(wildcard user/*.img)
user_object_files := $(patsubst user/%.img, build/user/%.o, $(user_image_files))
qemu_opts := -cdrom $(iso) -smp 4 -serial mon:stdio
features := use_apic
@ -95,6 +96,11 @@ build/arch/$(arch)/boot/%.o: $(boot_src)/%.asm
@mkdir -p $(shell dirname $@)
@nasm -felf64 $< -o $@
# make .o from .img file
build/user/%.o: user/%.img
@mkdir -p $(shell dirname $@)
@$(ld) -r -b binary $< -o $@
# used by docker_* targets
docker_image ?= blog_os
tag ?= 0.1

@ -3,10 +3,10 @@ use alloc::boxed::Box;
use process;
extern {
fn _binary_user_sfs_img_start();
fn _binary_user_sfs_img_end();
fn _binary_user_forktest_start();
fn _binary_user_forktest_end();
fn _binary_user_ucore32_img_start();
fn _binary_user_ucore32_img_end();
fn _binary_user_xv6_64_img_start();
fn _binary_user_xv6_64_img_end();
}
struct MemBuf(&'static [u8]);
@ -31,7 +31,7 @@ impl Device for MemBuf {
}
pub fn load_sfs() {
let slice = unsafe { MemBuf::new(_binary_user_sfs_img_start, _binary_user_sfs_img_end) };
let slice = unsafe { MemBuf::new(_binary_user_ucore32_img_start, _binary_user_ucore32_img_end) };
let sfs = SimpleFileSystem::open(Box::new(slice)).unwrap();
let root = sfs.root_inode();
let files = root.borrow().list().unwrap();
@ -45,7 +45,5 @@ pub fn load_sfs() {
process::add_user_process(name, unsafe { &BUF[..len] });
}
// process::add_user_process("forktest", unsafe { MemBuf::new(_binary_user_forktest_start, _binary_user_forktest_end).0 });
process::print();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save