Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 800067c)
raw | patch | inline | side by side (parent: 800067c)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Thu, 10 Jul 2014 16:55:19 +0000 (00:55 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Wed, 3 Nov 2021 02:45:37 +0000 (10:45 +0800) |
| Makefile | patch | blob | history | |
| drivers/ide.c | patch | blob | history | |
| fs/ext2.c | patch | blob | history | |
| kernel/clock.c | patch | blob | history | |
| scripts/init.sh | patch | blob | history |
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
sync
md5sum /boot/KERNEL.BIN
md5sum KERNEL.BIN
-
+ mkdir -p /kernel/bin/
+ cp bin/hello /kernel/bin/
+ cp bin/shell /kernel/bin/
cp:
./scripts/copy.sh
diff --git a/drivers/ide.c b/drivers/ide.c
--- a/drivers/ide.c
+++ b/drivers/ide.c
task->state = TASK_WAIT;
irq_save(flags);
finish = r->finish;
+ printd("%s pid %d finish %u read_scnt %u scnt %u\n", __func__, sysc_getpid(), r->finish, r->read_scnt, r->scnt);
irq_restore(flags);
if(finish)
diff --git a/fs/ext2.c b/fs/ext2.c
--- a/fs/ext2.c
+++ b/fs/ext2.c
extern void blk_rw(dev_t dev, u64_t offset, u32_t scnt, char *buf);
-#define BLKRW(blkid, blkcnt, buf) do { blk_rw(system.root_dev, (blkid)*EXT2_BLOCK_SIZE, (blkcnt)*EXT2_BLOCK_SIZE, buf); } while(0)
+#define BLKRW(blkid, blkcnt, buf) do { blk_rw(system.root_dev, 1ULL*(blkid)*EXT2_BLOCK_SIZE, (blkcnt)*EXT2_BLOCK_SIZE, buf); } while(0)
kmem_cache_t *ext2_block_cache;
kmem_cache_t *ext2_inode_cache;
ext2_inode_t ext2_root_inode;
+static ext2_inode_t boot_inode;
+static ext2_inode_t krnl_inode;
+
void *ext2_alloc_block()
{
return (void *) kmem_cache_alloc(ext2_block_cache, 0);
void *ext2_free_block(void *blk)
{
+ return;
kmem_cache_free(ext2_block_cache, blk);
}
}
#define ext2_gd(n) ((ext2_gd_t*)(EXT2_GD) + (n))
+unsigned int sys_clock();
void ext2_read_inode(unsigned int ino, ext2_inode_t *inode)
{
void *blk = ext2_alloc_block();
blkid += ext2_gd(gn)->bg_inode_table;
inoff *= EXT2_INODE_SIZE;
- printk("group %u %u blkid %u blkoff %u\n", gn, gi, blkid, inoff);
+ printd("group %u %u blkid %u blkoff %u clock %u\n", gn, gi, blkid, inoff, sys_clock());
BLKRW(blkid, 1, blk);
- memcpy(inode, blk+inoff, EXT2_INODE_SIZE);
+ memcpy(inode, blk+inoff, sizeof(ext2_inode_t));
ext2_free_block(blk);
}
return ino;
}
+
void ext2_setup_fs()
{
memset(&ext2_fs, 0, sizeof(ext2_fs));
printk("root inode size %u \n", ext2_root_inode.i_size);
printk("root blocks %u \n", ext2_root_inode.i_blocks);
- static ext2_inode_t boot_inode;
- static ext2_inode_t krnl_inode;
ext2_read_inode(ext2_search_indir("boot", &ext2_root_inode), &boot_inode);
ext2_read_inode(ext2_search_indir("Kernel", &boot_inode), &krnl_inode);
diff --git a/kernel/clock.c b/kernel/clock.c
--- a/kernel/clock.c
+++ b/kernel/clock.c
{
jiffies++;
- printd("^");
+ //printd("^");
printl(MPL_CLOCK, "clock:%d", jiffies);
}
diff --git a/scripts/init.sh b/scripts/init.sh
--- a/scripts/init.sh
+++ b/scripts/init.sh
sleep 1
-mkfs.ext2 $PART
+mke2fs -b 4096 $PART
sleep 1
cp ../KERNEL.BIN ${MNT}/boot/Kernel
mkdir -p ${MNT}/bin/
-cp ../bin/hw ${MNT}/bin/
-cp ../bin/sh ${MNT}/bin/
sleep 1