diff --git a/ChangeLog b/ChangeLog index ba2538e51..064ccd54d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-02-29 Vladimir Serbinenko + + * gentpl.py (kernel): Rewrite Apple part. + 2012-02-29 Vladimir Serbinenko * include/grub/kernel.h (FOR_MODULES): Check module magic. diff --git a/gentpl.py b/gentpl.py index d92e0e448..717fd50f8 100644 --- a/gentpl.py +++ b/gentpl.py @@ -417,8 +417,20 @@ def kernel(platform): r += gvar_add("platform_DATA", "[+ name +].img") r += gvar_add("CLEANFILES", "[+ name +].img") r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)", - if_platform_tagged(platform, "nostrip", "cp $< $@", - "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) + if_platform_tagged(platform, "nostrip", +"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \ + $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2031 -ed2022 -wd1106 -nu -nd $< $@; \ + elif test ! -z '$(TARGET_OBJ2ELF)'; then \ + cp $< $@.bin; $(TARGET_OBJ2ELF) $@.bin && cp $@.bin $@ || (rm -f $@.bin; exit 1); \ + else cp $< $@; fi""", +"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \ + $(STRIP) $(""" + cname() + """) -o $@.bin $<; \ + $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2031 -ed2022 -wd1106 -nu -nd $@.bin $@; \ +elif test ! -z '$(TARGET_OBJ2ELF)'; then \ + $(STRIP) $(""" + cname() + """_STRIPFLAGS) -o $@ $<;\ + $(TARGET_OBJ2ELF) $@.bin && cp $@.bin $@ || (rm -f $@.bin; exit 1); \ +else """ + "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<; \ +fi""")) return r def image(platform):