Page 1 of 1
Ach du leiber - bash actually works!
Posted: Sun Sep 16, 2007 8:13 am
by JamesM
Sorry for the random topic but I'm so utterly uber-chuffed I felt I had to shout it to the world:
I just successfully ported bash 3.2
Apart from hax0ring the config.h file because autoconf is a pile of sheep poo when cross-compiling, and adding in a few thousand stub "errno=EBUSY;return -1" functions, there wasn't much I had to do!
Screeny attached
BTW: a big thankyou to all the team at GNU bash for making their program so portable. I tried bash 2.0 and that was an absolute NIGHTMARE to port, so ty ty!
PS: kernel panic is due to my waitpid () function not working when execve fails. (and I haven't wrapped up execve in nice libc wrappers yet).
JamesM
Posted: Sun Sep 16, 2007 8:36 am
by Dex
Cool you have hit a OS Dev high, make the most of it, has its the only thing that keeps you going through the lows
.
Posted: Mon Sep 17, 2007 7:28 am
by Smilediver
Haha, cool! Congratulations! I'm very close to the same goal... all I'm left to do is get my fork() working, then some tweaks on execve() and same waitpid().
Oh yeah... and I guess later I'll need exit() too..
Re: Ach du leiber - bash actually works!
Posted: Tue Sep 18, 2007 12:07 am
by pcmattman
JamesM wrote:Sorry for the random topic but I'm so utterly uber-chuffed I felt I had to shout it to the world: I just successfully ported bash 3.2
Well done
Once I get my file i/o stuff figured out and my message passing works well enough, I'll be writing my execve implementation and then I'll port bash (and GCC, and binutils, and lots of other *nix tools).
PS: kernel panic is due to my waitpid () function not working when execve fails. (and I haven't wrapped up execve in nice libc wrappers yet).
Tell us when you get there without panics - it'd be nice to see a fully functional bash port working in a hobby OS.
Posted: Tue Sep 18, 2007 1:24 am
by JamesM
Heh, I made some changes to my libc and tried to recompile bash yesterday -- only to find that my doctored config.h had been overwritten. So now I can't remember what flags I had set, and bash keeps trying to compile in stuff which requires dirent.h -- which I haven't ported yet! D'oh! I'll have to port that tonight
Posted: Tue Sep 18, 2007 6:37 am
by Smilediver
JamesM wrote:Heh, I made some changes to my libc and tried to recompile bash yesterday -- only to find that my doctored config.h had been overwritten. So now I can't remember what flags I had set, and bash keeps trying to compile in stuff which requires dirent.h -- which I haven't ported yet! D'oh! I'll have to port that tonight
That sucks... I had to mess with config.h (and several other source files) too. But luckily, I've got dynamic libs working, so I don't have to recompile bash when I change newlib.
Posted: Wed Sep 19, 2007 12:19 pm
by JamesM
pcmattman: as per your request here is a progress update:
Now have bash working,executing files without panicing. Also (
) tab autocomplete works -- I was so unbelievably shocked!
It prints out it's autocomplete list dead slowly, one char at a time. I'll have to see if it's using write() or fwrite() because some buffering should be going on.
Some builtins work, like 'time' - although my 'times()' func is still a stub so it returns all zeroes.
It's still pretty sweet tho
Posted: Thu Sep 20, 2007 3:50 pm
by pcmattman
Wow. That's great!
I'm doing things the other way around: getting all the functionality I'll need to port bash, then porting it. So I already have a times() function, a gettimeofday() function, and I'm trying to figure out the best way to write my execve() function.
Now you just need to port GCC/binutils and then you can be fully self-hosting.
Posted: Fri Sep 21, 2007 2:15 am
by JamesM
That's the plan. However I noticed a bug in my scheduler last night and haven't managed to fix it yet. It comes out when I stick yield()s in the main() loops of my driver processes, but I can replicate it by adding a printf() line in the scheduler. Causes the program to jump to an illegal location - can't work out why atm!
Posted: Fri Sep 21, 2007 6:52 am
by Smilediver
JamesM wrote:but I can replicate it by adding a printf() line in the scheduler. Causes the program to jump to an illegal location - can't work out why atm!
Is your printf safe concurency wise? Could it be that someone is printing and timer interrupt causes scheduler to run, and scheduler tries to print at the same time? I had the same problem recently when I wanted to print some debug stuff in my scheduler.
Posted: Fri Sep 21, 2007 8:15 am
by JamesM
Nice idea, and I thought of it myself. Thing is my kernel is not preemptible, and certiainly not in the scheduler. Interrupts are disabled.
Posted: Sat Sep 22, 2007 11:36 pm
by OrOS
When can we get to see the first working image?
Posted: Sun Sep 23, 2007 2:35 am
by JamesM
Soon-ish. There are still some stability issues. I'm really just porting bash so I can get some ruby analysis tools I'm making to interact with my kernel over a serial connection.