Use redoxfs 0.4.4
This commit is contained in:
Generated
+3
-76
@@ -2,18 +2,6 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aes"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@@ -26,34 +14,6 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.117"
|
||||
@@ -87,12 +47,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "redox_bootloader"
|
||||
version = "0.1.0"
|
||||
@@ -115,16 +69,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redoxfs"
|
||||
version = "0.5.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/redoxfs.git?branch=0.5.0#a551f3a0b7ea2b004c62665c2bf4003b49ea7eb6"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcc31de09215010802574e370fce8534be7f3453ca76c4369e527b6924dafaa"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"generic-array",
|
||||
"libc",
|
||||
"log",
|
||||
"redox_syscall",
|
||||
"seahash",
|
||||
"simple_endian",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
@@ -134,17 +84,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "seahash"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||
|
||||
[[package]]
|
||||
name = "simple_endian"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/michalfita/simple-endian-rs.git?rev=7210f40881d16f7f2e3d8d40f6381fa222843caa#7210f40881d16f7f2e3d8d40f6381fa222843caa"
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.2"
|
||||
@@ -163,20 +102,8 @@ dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
+1
-5
@@ -12,9 +12,5 @@ crate-type = ["staticlib"]
|
||||
linked_list_allocator = "0.9.1"
|
||||
log = "0.4.14"
|
||||
redox_syscall = "0.2.10"
|
||||
redoxfs = { version = "0.4.4", default-features = false }
|
||||
spin = "0.9.2"
|
||||
|
||||
[dependencies.redoxfs]
|
||||
git = "https://gitlab.redox-os.org/redox-os/redoxfs.git"
|
||||
branch = "0.5.0"
|
||||
default-features = false
|
||||
|
||||
@@ -4,7 +4,7 @@ TARGET=$(ARCH)-unknown-none
|
||||
export LD=ld -m elf_i386
|
||||
export OBJCOPY=objcopy
|
||||
export PARTED=parted
|
||||
export QEMU=qemu-system-i386
|
||||
export QEMU=qemu-system-x86_64
|
||||
export RUST_TARGET_PATH=$(CURDIR)/targets
|
||||
|
||||
all: build/bootloader.bin
|
||||
|
||||
+16
-14
@@ -41,31 +41,33 @@ impl DiskBios {
|
||||
}
|
||||
|
||||
impl Disk for DiskBios {
|
||||
unsafe fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
|
||||
fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
|
||||
for (i, chunk) in buffer.chunks_mut(BLOCK_SIZE as usize).enumerate() {
|
||||
let mut dap = DiskAddressPacket::from_block(block);
|
||||
ptr::write(DISK_ADDRESS_PACKET_ADDR as *mut DiskAddressPacket, dap);
|
||||
unsafe {
|
||||
let mut dap = DiskAddressPacket::from_block(block);
|
||||
ptr::write(DISK_ADDRESS_PACKET_ADDR as *mut DiskAddressPacket, dap);
|
||||
|
||||
let mut data = ThunkData::new();
|
||||
data.ax = 0x4200;
|
||||
data.dx = self.boot_disk as u16;
|
||||
data.si = DISK_ADDRESS_PACKET_ADDR as u16;
|
||||
let mut data = ThunkData::new();
|
||||
data.ax = 0x4200;
|
||||
data.dx = self.boot_disk as u16;
|
||||
data.si = DISK_ADDRESS_PACKET_ADDR as u16;
|
||||
|
||||
data.with(self.thunk13);
|
||||
data.with(self.thunk13);
|
||||
|
||||
//TODO: return result on error
|
||||
assert_eq!(data.ax, 0);
|
||||
//TODO: return result on error
|
||||
assert_eq!(data.ax, 0);
|
||||
|
||||
//TODO: check blocks transferred
|
||||
dap = ptr::read(DISK_ADDRESS_PACKET_ADDR as *mut DiskAddressPacket);
|
||||
//TODO: check blocks transferred
|
||||
dap = ptr::read(DISK_ADDRESS_PACKET_ADDR as *mut DiskAddressPacket);
|
||||
|
||||
ptr::copy(DISK_BIOS_ADDR as *const u8, chunk.as_mut_ptr(), chunk.len());
|
||||
ptr::copy(DISK_BIOS_ADDR as *const u8, chunk.as_mut_ptr(), chunk.len());
|
||||
}
|
||||
}
|
||||
|
||||
Ok(buffer.len())
|
||||
}
|
||||
|
||||
unsafe fn write_at(&mut self, block: u64, buffer: &[u8]) -> Result<usize> {
|
||||
fn write_at(&mut self, block: u64, buffer: &[u8]) -> Result<usize> {
|
||||
log::error!(
|
||||
"DiskBios::write_at(0x{:X}, 0x{:X}:0x{:X}) not allowed",
|
||||
block,
|
||||
|
||||
+10
-5
@@ -95,13 +95,18 @@ pub unsafe extern "C" fn kstart(
|
||||
let disk = DiskBios::new(boot_disk as u8, thunk13);
|
||||
//TODO: get block from partition table
|
||||
let block = 1024 * 1024 / redoxfs::BLOCK_SIZE;
|
||||
match redoxfs::FileSystem::open(disk, Some(block), false) {
|
||||
match redoxfs::FileSystem::open(disk, Some(block)) {
|
||||
Ok(mut fs) => {
|
||||
info!("RedoxFS {} MiB", fs.header.size() / 1024 / 1024);
|
||||
info!("RedoxFS {} MiB", fs.header.1.size / 1024 / 1024);
|
||||
|
||||
match fs.tx(|tx| tx.find_node(redoxfs::TreePtr::root(), "kernel")) {
|
||||
Ok(node) => {
|
||||
info!("Kernel {} MiB", node.data().size() / 1024 / 1024);
|
||||
match fs.find_node("kernel", fs.header.1.root) {
|
||||
Ok(node) => match fs.node_len(node.0) {
|
||||
Ok(len) => {
|
||||
info!("Kernel {} MiB", len / 1024 / 1024);
|
||||
},
|
||||
Err(err) => {
|
||||
error!("Failed to read kernel file length: {:?}", err);
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
error!("Failed to find kernel file: {:?}", err);
|
||||
|
||||
Reference in New Issue
Block a user