Ach du leiber - bash actually works!

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Ach du leiber - bash actually works!

Post 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 :D :D :D :D

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
Attachments
snapshot13.png
snapshot13.png (25.22 KiB) Viewed 4183 times
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post 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 :wink: .
Smilediver
Member
Member
Posts: 37
Joined: Sun Aug 05, 2007 4:23 pm

Post 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.. :-)
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Ach du leiber - bash actually works!

Post 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 :D

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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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 :(
Smilediver
Member
Member
Posts: 37
Joined: Sun Aug 05, 2007 4:23 pm

Post 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. :-)
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

pcmattman: as per your request here is a progress update:

Now have bash working,executing files without panicing. Also ( :o ) 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 8)
Attachments
snapshot14.png
snapshot14.png (14.87 KiB) Viewed 4057 times
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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! :roll:
Smilediver
Member
Member
Posts: 37
Joined: Sun Aug 05, 2007 4:23 pm

Post 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! :roll:
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. :-)
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
OrOS
Member
Member
Posts: 143
Joined: Sat Sep 08, 2007 11:26 pm
Location: Canada

Post by OrOS »

When can we get to see the first working image?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
Post Reply