From eb142756d8856316069f148afca5ff1727de1683 Mon Sep 17 00:00:00 2001 From: AceVest Date: Wed, 9 Jul 2014 23:13:50 +0800 Subject: [PATCH] update bin/Makefile --- bin/Makefile | 28 +++++++++++++---------- bin/hello | Bin 0 -> 17211 bytes bin/{helloworld.c => hello.c} | 4 ++-- bin/helloworld.S | 30 ------------------------ bin/shell | Bin 0 -> 17296 bytes bin/shell.S | 29 ----------------------- bin/shell.c | 42 +++------------------------------- drivers/blk_rw.c | 2 +- drivers/ide.c | 3 +-- fs/ext2.c | 8 +++---- {lib => kernel}/assert.c | 0 kernel/cpuid.c | 2 +- kernel/setup.c | 5 ++-- lib/keyboard.c | 2 ++ lib/libc.S | 22 ++++++++++++++++++ scripts/copy.sh | 4 ++-- 16 files changed, 56 insertions(+), 125 deletions(-) create mode 100755 bin/hello rename bin/{helloworld.c => hello.c} (93%) delete mode 100644 bin/helloworld.S create mode 100755 bin/shell delete mode 100644 bin/shell.S rename {lib => kernel}/assert.c (100%) create mode 100644 lib/libc.S diff --git a/bin/Makefile b/bin/Makefile index a64df42..848260c 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,20 +1,24 @@ CC = gcc +LDFLAG = -e _start CFLAGS = -c -I../include -fno-builtin -LDOBJS = ../lib/errno.c.o ../lib/fork.c.o ../lib/lib.c.o ../lib/open.c.o \ - ../lib/stat.c.o ../lib/string.c.o ../lib/write.c.o ../lib/exec.c.o \ - ../lib/vsprintf.c.o ../lib/read.c.o \ - ../lib/keyboard.c.o ../lib/exit.c.o ../lib/syscall.c.o -all: - gcc -c shell.S -o shell.S.c.o - gcc $(CFLAGS) shell.c -o shell.c.o - ld $(LDOBJS) shell.S.c.o shell.c.o -o sh - gcc -c helloworld.S -o helloworld.S.c.o - gcc $(CFLAGS) helloworld.c -o helloworld.c.o - ld $(LDOBJS) helloworld.S.c.o helloworld.c.o -o hw +LIBC_DIRS = ../lib +LIBC_SRCS := $(foreach DIR, $(LIBC_DIRS), $(wildcard $(DIR)/*.[cS])) +LIBC_OBJS := $(patsubst %,%.o,$(LIBC_SRCS)) +BINS := shell hello + +all:$(BINS) + +shell: shell.o + gcc $(CFLAGS) shell.c -o shell.o + ld ${LIBC_OBJS} shell.o -o shell +hello: hello.o + gcc $(CFLAGS) hello.c -o hello.o + ld $(LIBC_OBJS) hello.o -o hello + .PHONY:clean clean: - rm sh hw helloworld.c.o -f + rm $(BINS) *.o -f .PHONY:c c: make clean diff --git a/bin/hello b/bin/hello new file mode 100755 index 0000000000000000000000000000000000000000..9df53d89f0491da600e6835ba85c0bafe8bbc43d GIT binary patch literal 17211 zcmdU03v^V~x!&i@nVFLZnIVaQg4d7*6|95=P*I`s8W7|q5EaG7kW6MqCXdd8hXth_ zABm|~)7#bd+T6AC)vmVJ>$TWM!@5PKH7(KH@7s@=6Ce~@ z)?KT!$T|Dp|8xKQ-~ay4K8M>P%NJXgCCtwjK0)Zn6EfizYb-oJo|^Hy28te@0V8N{J$sGpX;{p`oGYpSe%|`szxAP|f@L-}lPvUJ>qE zKB?3rmRkFQQf$k8_Zi7XX%VsCf>jVLabc>94Bm&^J*%y*dKY%yv&`yRQ5xD^-Wd+< z7Ps%qzSbQX)K-QMLtI)8Ah%;c ziXP}6yK~2o$lCqIxz@0i+YuJo-NOV!EKK2$Tn;n%^= zFnyGZ3_xi3p4CHL_2E1AWnTrg9#JJ&IwSC!R38G1^w1y%a<~%`3QUKL4-Q0*(j~(* zP6H#Iy8ED1jmAFZf}^<|M@7c&FE@7N$N%H*$WbkF0_{e?o%{aKkoH;@6XNzSp%Ne* zi5Tp^AlJ$nA3%`0f69+Gk45WXez1*T=jiKEc8Qi&JaQdyIaJ}@l z;Nx7J{eJIkRGJ8z)LlQ=b?~WIZR?=55Ay?V6`~yL-hH{gT1$2+kd}T{*>M2=(1ROy z09MjrSa3FOeUCz+7f1aD_gRTEYeueDu$PkEv%t9Q`@SYg^|gCjR*Cj(hbQEW^+&IXq?b+T39*vH|jf2+OhS#rSJp$^pzlZh!cO8<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`VQA82M)% zhljiKKjIeyGVh-8geR^BY~CjmW;~hq!h~ah&8uC)T(ahkEa4r1&C655oq)}c`tCIV z?u2;~ZhnNnY5?2`KXe@Y7~p-VahBsw`Q9Jt`C+5^Jggk}rvaOHtAt-51CF9OlcS;G zXSkc!EyVv4uzAT!_z+;e*Josqp2y?nBPinE0&HH95#PQ zZ!}=@hL(69!kf<&2u}oTzU(A?K49}97vUPf=5tZPvjCgVVhCRjn9t!b3+u`f3jmuh zl!)i2ynKRY{v*5+u=ya3@HK$Vdt1Uc0XARR5KaJQ4bN9?g!w|jd~`+l7Qp6B0pZ&K zn^%y8?*PpCz!mm6q6e_~28?*-!cwf)DO&!&05%`o5&sqP>o+%q9|X+Lc+C8M3$Xe0 zi1^*4_vqud!&Q$J^gj*QeECTF1Axs(NrYbjY+g7M{yAXt(I8>IO5ro-1=`-%0Gk(7 z#G{UqM=!c4(=`~jK6P}UY9C$am>S1CKbpG#Ow=VOM)J1{( zKUV1s?@fTnwH literal 0 HcmV?d00001 diff --git a/bin/helloworld.c b/bin/hello.c similarity index 93% rename from bin/helloworld.c rename to bin/hello.c index 8b4e9c8..917720f 100644 --- a/bin/helloworld.c +++ b/bin/hello.c @@ -1,6 +1,6 @@ /* *-------------------------------------------------------------------------- - * File Name: helloworld.c + * File Name: hello.c * * Author: Zhao Yanbai [zhaoyanbai@126.com] * Tue Feb 23 22:44:40 2010 @@ -12,7 +12,7 @@ #include #include -int hw() +int main() { printf("hello world\n"); //syscall3(SYSC_WRITE, 0, "fuck", 5); diff --git a/bin/helloworld.S b/bin/helloworld.S deleted file mode 100644 index 55c1ab8..0000000 --- a/bin/helloworld.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - *-------------------------------------------------------------------------- - * File Name: helloworld.S - * - * Author: Zhao Yanbai [zhaoyanbai@126.com] - * Tue Feb 23 20:15:27 2010 - * - * Description: none - * - *-------------------------------------------------------------------------- - */ -#define ASM -#include -.global _start -_start: - nop - nop - nop - #xchg %bx, %bx -loop: - #jmp loop - call hw - - nop - nop - nop - nop - nop -die: - jmp die diff --git a/bin/shell b/bin/shell new file mode 100755 index 0000000000000000000000000000000000000000..2be5a31a4b149db06511776db49fd4aacaafa143 GIT binary patch literal 17296 zcmdU04Rl<^b)NV3?e5c$wQEU$z^0LPn@TLBXjAxo>>#rlhO z*I=;0$?_vb<$yRjX_~6RZIk|_q#-%frQo_I7z}CB(vp^(Hl;K%i9kNB6WpK#1@-&x z%nNoRoyu8p8cM5yrD!+f4V2Fh(9For=>Art<`Zm%0&<4GZ*9<2n zV*6p&$-y{nR7gxfX#9aqQ$wxsdk^Jb1+^JbEm#H0Io5q`|P@Tohy9M2A5f`?t8y3(l??S+8KPBzs_iaoLakp^%z!nYI1ywMfpf zJ3)%6EKQ)S9}Fh_#66yW-St?8v86IRt@P%?F)XqP@`4Dv=|x2hG5G*bt-?3@D=tPRk5{+qeF=kM-qB6S}{|;^DVQ8 zhiV(gj{jn6>PX@kr^*zJ$H#_Sk2^08fe_S)tlt}S3yEWh0mm*+9NqnIFzTg=vDk*h zn32vZOE`NUx5ao1ovEGyxt(1 zbLFO1pP!{`gNbo1K!!Empj&NhI1cRt@#8p2jf6#aSy`9f_3hye$Dd4fb#)Cr|JEB% z|I!_L{^^MiXq&<-&2Ci~>nKc|6}$f&j?BAv?{9kk)T@DkVWY%u`T8$pisHixUg15E z_)`X@1z?FCOpFh=9>a`dtsO_f=;@O{g6Ij-h2bF%jQ8h|5j)sA4hI-k!yArae~&}O z;5Ltr$??*!G)LhSy>_2wuMcV&z(LpN ziXj&Zi@U4dx@D8}xzEAKty6@9>3y8%3>u;sziCWddGc;G6B zl?|1roI|sFAldl#(2Ipb&4ZztD2Ec2ve+I)bd|k&0&0(+r}sM>jXr`U%Kfd-!#&-{ z9yjnx;c#6s6eA#rS{o)FSSf1VT>0d8zw@2%41NEtA3ps?sOXIsJ~Q;sS|56(ki7Ln zV8=pMjRWtc#$#}m8P&k{AzDnD)ed9Mg@cUWikaYU^7Kn@p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D?%TboMWp6uAEyF(4@vwZ*yJ~xn0N@F14(F5DMGTq&(y&FEM zvbVMOw~1TAF5PP7`n7AWZM%N$nrpVGuJ-OMrn;@aFRL=SzIH`6oHC)F=k0dYAvhUv z8_zRo9d@176DD%oIxxxXfTb3{K5_LHWpz^hnNBzdLKl+r~2z+Bk8a5j9Xj13{ z0~0vl00IXLByhm60*e^b^c9j(Scv+RPt)5|Kb;D45RR3|VT+$moqZDgfs^3*C&57< zBmdHq@Gy7rBK~SX_T4j{@YHpH?fYcH^e6jXm~aZPeYH!NOV+-TCAJh|F2aid+s{P_UkuoO7DISBU_OUKEvzd? z@q1DGg%a_6gTW_g#y`Rv0oxDK2=n!neQ!&+9kBh%hVZR`nZxr{8{r&a`_UEQI|17_ z1%&qkwyz)w&Nyw&?I3Mb;8DS}>lB~|sBlXvLSBpu@Oe&Z{>eSKGSwt_< zSxzY",ch); - } - } - - - return 0; -} -#endif diff --git a/drivers/blk_rw.c b/drivers/blk_rw.c index 2b7865f..1441f59 100644 --- a/drivers/blk_rw.c +++ b/drivers/blk_rw.c @@ -27,7 +27,7 @@ void blk_rw(dev_t dev, u64_t offset, u32_t size, char *buf) u32_t scnt = size / SECT_SIZE; - printk("%s lba %u scnt %u\n", __func__, (u32_t)lba, scnt); + printd("%s lba %u scnt %u\n", __func__, (u32_t)lba, scnt); ide_do_read(lba, scnt, buf); } diff --git a/drivers/ide.c b/drivers/ide.c index 1e4be54..3d2f6cc 100644 --- a/drivers/ide.c +++ b/drivers/ide.c @@ -80,7 +80,6 @@ void ide_printl() void ide_cmd_out(dev_t dev, u32 sect_cnt, u64 sect_nr, u32 cmd) { - printk("sect_cnt %u sect_nr %u \n", sect_cnt, (u32)sect_nr); drv.pio_cnt++; drv.read_mode = cmd; @@ -230,7 +229,7 @@ void init_pci_controller(unsigned int classcode) void ide_default_intr() { - printk("%s\n", __func__); + printd("%s\n", __func__); u8_t status = inb(REG_STATUS(0)); drv.irq_cnt++; diff --git a/fs/ext2.c b/fs/ext2.c index ce08dec..45cf95a 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -26,8 +26,6 @@ void ext2_setup_fs() if(buf == 0) panic("out of memory"); - printk("EXT2_BLOCK_SIZE %u\n", EXT2_BLOCK_SIZE); - BLKRW(EXT2_SB_OFFSET, 1, buf); memcpy(EXT2_SB, buf, sizeof(*(EXT2_SB))); @@ -39,11 +37,11 @@ void ext2_setup_fs() } printk("Ext2 File System Information:\n"); - printk("inodes cnt %u blocks cnt %u free blocks %u free inodes %u\n", + printk(" inodes %u blocks %u free blocks %u free inodes %u\n", EXT2_SB->s_inodes_count, EXT2_SB->s_blocks_count, EXT2_SB->s_free_blocks_count, EXT2_SB->s_free_inodes_count); - printk("block size %u log block size %u first data block %u\n", + printk(" block size %u log block size %u first data block %u\n", EXT2_BLOCK_SIZE, EXT2_SB->s_log_block_size, EXT2_SB->s_first_data_block); - printk("blocks per group %u inodes per group %u\n", EXT2_SB->s_blocks_per_group, EXT2_SB->s_inodes_per_group); + printk(" blocks per group %u inodes per group %u\n", EXT2_SB->s_blocks_per_group, EXT2_SB->s_inodes_per_group); } diff --git a/lib/assert.c b/kernel/assert.c similarity index 100% rename from lib/assert.c rename to kernel/assert.c diff --git a/kernel/cpuid.c b/kernel/cpuid.c index 383cb81..6d94a79 100644 --- a/kernel/cpuid.c +++ b/kernel/cpuid.c @@ -71,7 +71,7 @@ void detect_cpu() memcpy(pbs + 40 , &r.ecx, 4); memcpy(pbs + 44 , &r.edx, 4); pbs[48] = 0; - printk("Model Name: %s",pbs); + printk("%s",pbs); /**********************Get Number of Processors********************/ int pn;//number of logical processors in one physical processor diff --git a/kernel/setup.c b/kernel/setup.c index e0239e3..afeef42 100644 --- a/kernel/setup.c +++ b/kernel/setup.c @@ -54,6 +54,7 @@ const char *version = " by " BUIDER; +int main() { } // for libc void setup_kernel() { @@ -92,8 +93,8 @@ void setup_kernel() detect_cpu(); - printk("%s\n", version); - setup_fs(); + + printk("%s\n", version); } diff --git a/lib/keyboard.c b/lib/keyboard.c index 0a3a896..c9043aa 100644 --- a/lib/keyboard.c +++ b/lib/keyboard.c @@ -13,6 +13,7 @@ * *-------------------------------------------------------------------------- */ +#if 0 #include #include #include @@ -227,3 +228,4 @@ End: return -1; } +#endif diff --git a/lib/libc.S b/lib/libc.S new file mode 100644 index 0000000..0d3c9af --- /dev/null +++ b/lib/libc.S @@ -0,0 +1,22 @@ +.extern main +.global _start + +_start: + nop + nop + nop + nop + nop + nop + + call main + + nop + nop + nop + nop + nop + nop + nop +1: + jmp 1b diff --git a/scripts/copy.sh b/scripts/copy.sh index efdd1db..44f2f07 100755 --- a/scripts/copy.sh +++ b/scripts/copy.sh @@ -16,8 +16,8 @@ cp scripts/grub.cfg /mnt/boot/grub2/ md5sum /mnt/boot/Kernel mkdir -p /mnt/bin/ -cp ./bin/hw /mnt/bin/ -cp ./bin/sh /mnt/bin/ +cp ./bin/shell /mnt/bin/ +cp ./bin/hello /mnt/bin/ umount /mnt/ -- 2.44.0