Jump to content

Lion kernel testing on AMD (don't ask help here: use the Help Topic)


  • Please log in to reply
605 replies to this topic

#61
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

So the problem is that kernel can't launch 64-bit processes? :o
Clever solution, even if it doesn't work. I must admit that I admire your wisdom. :)

EDIT: Lion 10.7 myHack usb with AnV kernel: Kernel is LP64.
32-bit only launchd is impossible to make, only x86_64 in the vanilla launchd.
I will try to patch the dyld and try i386 launchd from SL.

No i386 launchd?
How does it boot with -legacy then?

I think we may have something here...
If it doesn't load launchd and works we may be able to get it to go...

#62
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh

No i386 launchd?
How does it boot with -legacy then?


Good point. Now I'm totally confused... I'll try to look again.
NOTE: This is just myHack USB, it may have something different.
Or it might be my dmg or something.

EDIT: I'll install Lion retail to another partition. This should give us i386 launchd. :)

#63
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Good point. Now I'm totally confused... I'll try to look again.
NOTE: This is just myHack USB, it may have something different.
Or it might be my dmg or something.

Please check...
If launchd isn't needed we could mod the kernel...

#64
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Good point. Now I'm totally confused... I'll try to look again.
NOTE: This is just myHack USB, it may have something different.
Or it might be my dmg or something.

Please check...
If launchd isn't needed we could mod the kernel...

Good point. Now I'm totally confused... I'll try to look again.
NOTE: This is just myHack USB, it may have something different.
Or it might be my dmg or something.

Please check...
If launchd isn't needed we could mod the kernel...

#65
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh
Okay... Now my mind is finally blown.
Mounted the InstallESD.dmg.

sh-3.2# cd /Vol*/Mac*
sh-3.2# cd sbin
sh-3.2# file launchd
launchd: Mach-O 64-bit executable x86_64

I gotta try this with my other Lion dmg...

#66
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...
:D
Lets hope it is the same!
I could then check for AMD cpu and bypass launchd...

#67
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh

:D
Lets hope it is the same!
I could then check for AMD cpu and bypass launchd...


This is pretty damn weird... But... If you say it is good...

sh-3.2# cd "/Volumes/Mac OS X Base System/sbin"
sh-3.2# ls | grep launchd
launchd
sh-3.2# file launchd
launchd: Mach-O 64-bit executable x86_64

And I think this is 10.7.5 BaseSystem.dmg. :)

EDIT: I think we may have wrong alert... Asked @ IRC #LegacyKernel if someone could do the file /sbin/launchd command... Yousseflion uses 32-bit Lion (on AMD I think) and he got this:
sh-3.2# sudo file /sbin/launchd
/sbin/launchd: Mach-O universal binary with 2 architectures
/sbin/launchd (for architecture x86_64): Mach-O 64-bit executable x86_64
/sbin/launchd (for architecture i386): Mach-O executable i386



EDIT2: I'll make myHack USB with 10.7.5 now. Launchd is x86_64 only. I'll try to boot it with BronzovkaAnv kernel, i386 and -legacy. If it boots... Then I'm just like WTF.

#68
spakk

spakk

    If you try to please everyone, then you have certainly forgotten

  • Local Moderators
  • 1,967 posts
  • Gender:Male
  • Location:marocain

This is pretty damn weird... But... If you say it is good...

sh-3.2# cd "/Volumes/Mac OS X Base System/sbin"
sh-3.2# ls | grep launchd
launchd
sh-3.2# file launchd
launchd: Mach-O 64-bit executable x86_64

And I think this is 10.7.5 BaseSystem.dmg. :)

EDIT: I think we may have wrong alert... Asked @ IRC #LegacyKernel if someone could do the file /sbin/launchd command... Yousseflion uses 32-bit Lion (on AMD I think) and he got this:
sh-3.2# sudo file /sbin/launchd
/sbin/launchd: Mach-O universal binary with 2 architectures
/sbin/launchd (for architecture x86_64): Mach-O 64-bit executable x86_64
/sbin/launchd (for architecture i386): Mach-O executable i386



EDIT2: I'll make myHack USB with 10.7.5 now. Launchd is x86_64 only. I'll try to boot it with BronzovkaAnv kernel, i386 and -legacy. If it boots... Then I'm just like WTF.


I always get this message, big {censored}

bash-3.2# Mach-O executable i386
bash: Mach-O: command not found
bash-3.2#

what am I doing wrong? :wallbash:

#69
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...
In the meantime I did some more work on ML kernel (kern_exec.c)
I made launchd disable with -nolaunchd boot arg
Also it doesn't panic on launchd anymore.
I also put the cs flags in there to always valid.
It also doesn't check exec permissions anymore...
We will see the result later...

#70
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh

I always get this message, big {censored}

bash-3.2# Mach-O executable i386
bash: Mach-O: command not found
bash-3.2#

what am I doing wrong? :wallbash:


:D Sorry I'm laughing for you... Mach-O isn't a command.

sh-3.2# file /sbin/launchd

is the only command I've ran, and the

launchd: Mach-O 64-bit executable x86_64

is the result of it.




In the meantime I did some more work on ML kernel (kern_exec.c)
I made launchd disable with -nolaunchd boot arg
Also it doesn't panic on launchd anymore.
I also put the cs flags in there to always valid.
It also doesn't check exec permissions anymore...
We will see the result later...


:) Nice to see ML progress too! :D

#71
spakk

spakk

    If you try to please everyone, then you have certainly forgotten

  • Local Moderators
  • 1,967 posts
  • Gender:Male
  • Location:marocain
from Lion 10.7.2 launchd i386
launchd orig

I hope I did not make s-hit

#72
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...
Guess what is in the exec_check_permissions function I removed... return(EACCESS) also known as errno=13:D

#73
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh

from Lion 10.7.2 launchd i386



Nice to see you could do it. :)
Have you tried to boot with it yet?

I looked @ kern_exec.c and couldn't fail to notice this:

* Notes: The process that is passed in is the first manufactured
* process on the system, and gets here via bsd_ast() firing
* for the first time. [b]This is done to ensure that bsd_init()
* has run to completion.[/b]

It sounds like the load_init_program is just a test to see if bsd_init() has ran?
So it could it just be like a verify process in the bsd_init()?

Guess what is in the exec_check_permissions function I removed... return(EACCESS) also known as errno=13:D


xD You can't be serious? So... Correct permissions would work? :D
LOL... I'm really rolling on the floor laughing.... You really are a wizard! :)

#74
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...
I just posted the ML version...
The mods in kern_exec.c can be applied to the Lion diff too...

Booting now...

-nolaunchd is a no-go...
It just stops after Kernel is LP64
Trying stock (without -nolaunchd)

#75
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh
Here is a Lion kernel with few changes to kern_exec.c. Also, it should launchd fsck_hfs instead of launchd... It's just a test.
X86_64 only, no need to even try with i386 -legacy.

Download

I will post diff later if someone needs it, but basicly it's just AnV lion with launchd -> fsck_hfs and few debug messages.

Mm'kay, I'm experimenting with different things in kern_exec.c... I'll post my test kernels on this post, try and tell me if you get any further than Kernel is LP64 or launchd errno. :D




lion-test-0 - Should stuck @ errno 13 or Kernel is LP64. Arch x86_64 only.
http://www.solidfile...m/d/d6b64345d2/

lion-test-1 - Some debug messages, should still get stuck...
http://www.solidfile...m/d/9ffd0f459d/

lion-test-2 - Okay... Now I'm getting frustrated. Added over 20 debug messages to see where this damn kernel stucks.
http://www.solidfile...m/d/4fbb6a1db4/

lion-test-3 - More debugging, now with bsd_init.c
http://www.solidfile...m/d/d5c3b4c098/

lion-test-4 - Same as lion-test-3, but with parts of SL code
http://www.solidfile...m/d/209880df2a/

lion-test-5 - More debugging... execve()
http://www.solidfile...m/d/2b4f29c452/

lion-test-6 - A little more... debugging? I may have a little clue why it stucks on Kernel is LP64...
http://www.solidfile...m/d/4af3e357c8/

lion-test-7 - Just to verify what I'm thinking... Something related to check_for_signature()
http://www.solidfile...m/d/6ac85e795b/

lion-test-8 - Skips some EACCES parts...
http://www.solidfile...m/d/f05e9bda2e/

lion-test-9 - More debug messages, special surprise... (If it can even run to that point...)
http://www.solidfile...m/d/72c8723623/

lion-test-10 - This may get past Kernel is LP64...
http://www.solidfile...m/d/415cc6f220/

lion-test-11 - More f u c k i n g debugging...
http://www.solidfile...m/d/f683b58def/

lion-test-12 - This is weird...
http://www.solidfile...m/d/5870b0838b/

#76
instant idiot

instant idiot

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 182 posts
  • Gender:Male
Should I test all of them, or just the latest one?

#77
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,641 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...
How is the test coming around?
We need to know more before we can proceed...

#78
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh
Not sure... This is pretty damn weird... It runs bsd_init(),bsdinit_task() and even the whole kern_exec.c runs... But launchd doesn't want to run.

New kernel @ attachements, it gives "Err: 0" just before the bsd_init() is done... And this is message added by me to execve():


int
execve(proc_t p, struct execve_args *uap, int32_t *retval)
{
printf("execve()...\n");
struct __mac_execve_args muap;
int err;
muap.fname = uap->fname;
muap.argp = uap->argp;
muap.envp = uap->envp;
muap.mac_p = USER_ADDR_NULL;
err = __mac_execve(p, &muap, retval);
printf("Err: %d\n", err); //<--- THERE
return(err);
}

And _mac_execve returns 0 on success, but launchd doesn't run... :D

lion-test-16 diff: http://www.solidfile...m/d/9a29b63572/

Attached Files



#79
instant idiot

instant idiot

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 182 posts
  • Gender:Male
lion-test-16 -v arch=x86-64 npci=0x3000
BSD root: disk4s2, major 14, minor 16
bsd_utaskbootsrtap() started
Kernel is LP64
bsdinit_task() started
Setting security token
execve()...
__mac_execve()...
exec_activate_image() started
execargs_alloc() started
return (0)
exec_save_path () started
goto bad_notrans; - 1
goto bad_notrans; - 2
exec_check_permissions() started
pal_kernel_announce() started
goto bad; - 1
calling mountroot_post_hook
calling mountroot_post_hook (again)
bsd_init() done?
goto bad; - 2
goto bad; - 3
in the for loop now...
exec_mach_imgact() started
in the for loop now...
exec_fat_imgact() started
goto bad; - 3
in the for loop now...
exec_mach_imgact() started
exec_add_user_string() started
exec_apple_strings() started
exec_add_user_string() started
exec_add_user_string() started
Setting security token
goto again; - 1
bad:proc_transend(p, 0);
bad_notrans: returning error
check_for_signature() started
skipping KERN_FAILURE
proc_lock(p)
proc_unlock(p)
switch_protect
Signed or not?
CS_valid. Going to done.
Well, we went to done.
I think we're returning error... ?
Err: 0
end of bsdinit_task()?

It does, of course, just hang there.

#80
Deltac0

Deltac0

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
  • Location:Finland
  • Interests:Caffeine, OS X, AMD Hackintosh

lion-test-16 -v arch=x86-64 npci=0x3000
BSD root: disk4s2, major 14, minor 16
bsd_utaskbootsrtap() started
Kernel is LP64
bsdinit_task() started
Setting security token
execve()...
__mac_execve()...
exec_activate_image() started
execargs_alloc() started
return (0)
exec_save_path () started
goto bad_notrans; - 1
goto bad_notrans; - 2
exec_check_permissions() started
pal_kernel_announce() started
goto bad; - 1
calling mountroot_post_hook
calling mountroot_post_hook (again)
bsd_init() done?
goto bad; - 2
goto bad; - 3
in the for loop now...
exec_mach_imgact() started
in the for loop now...
exec_fat_imgact() started
goto bad; - 3
in the for loop now...
exec_mach_imgact() started
exec_add_user_string() started
exec_apple_strings() started
exec_add_user_string() started
exec_add_user_string() started
Setting security token
goto again; - 1
bad:proc_transend(p, 0);
bad_notrans: returning error
check_for_signature() started
skipping KERN_FAILURE
proc_lock(p)
proc_unlock(p)
switch_protect
Signed or not?
CS_valid. Going to done.
Well, we went to done.
I think we're returning error... ?
Err: 0
end of bsdinit_task()?

It does, of course, just hang there.


Yep, no idea why it just can't run launchd... load_init_program() returns no error etc...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy