How To Guide [SOURCE] ASUS_I005_1-kernel (MacOS / Linux)

Search This thread

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Restoring Stock / Rooted Boot Image

    Compiling on MacOS (Mojave or lower)

    Custom Kernel Development on MacOS

    This is NOT a custom kernel!

    GPL requires that source is released for Android kernels.
    It does not, however, require that the source is tracked.

    Each release is downloaded, extracted, and added to git in a single repo in order to create a kernel changelog. Some commits may be added to improve building the kernel as a standalone binary. The core functionality and features will remain unchanged.

    The IKCONFIG is then pulled from a running device to get the compiler hash

    The source provided by ASUS is meant to be built as a complete firmware.
    Some commits have been added to fix broken links and restore missing code.
    The source, as it is provided, does not build without missing components.
    There are changes required to use newer versions of LLVM that were already included in the CAF source, but not in the one from Asus.

    commit 210ecf9a8921bccf197372da9a91efb8aa38202f
    Author: Sami Tolvanen <[email protected]>
    Date:   Wed Nov 25 08:44:09 2020 -0800
        ANDROID: merge compound literal sections
        After LLVM rG9e33c096476a ("[ELF] Keep orphan section names
        ( unchanged if !hasSectionsCommand"), LLD splits
        compound literals to separate sections with -fdata-sections, which
        it always enables with LTO. Merge these sections to allow LLVM to be
        Bug: 174047799
        Change-Id: I858c5fcc48283d5528c1d3e2b2d7a3c72f9e03d6
        Suggested-by: Danny Lin <[email protected]>
        Suggested-by: Fangrui Song <[email protected]>
        Signed-off-by: Sami Tolvanen <[email protected]>
        (cherry picked from commit 559c23e691b8d0b25b055ecdf4c07f19c8407794)
        (cherry picked from commit 6f7ffcefc7b0ad82dbe0975057ea82b045abe160)
    diff --git a/include/asm-generic/ b/include/asm-generic/
    index ef257c136f11..b5c86d85f7b3 100644
    --- a/include/asm-generic/
    +++ b/include/asm-generic/
    @@ -72,10 +72,10 @@
    #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
    #define TEXT_CFI_MAIN .text.[0-9a-zA-Z_]*.cfi
    -#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX*
    +#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral*
    #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
    -#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]*
    -#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
    +#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
    +#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
    #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
    #define TEXT_MAIN .text

    The techpack is only a stub and folder layout, but is also missing parts.
    For anyone unfamiliar with Asus source, it may not be immediately obvious that there are four additional components that are required.

    The modules do collide, but can be built in hybrid fashion to overcome the issues.



    The easiest method for building the kernel is to make all modules inline (replace m with y).

    Modules will still be unable to load on their own, since the signatures and versions may be off. That is why the verification needs to be disabled.

    commit e009a01e9cf2f0c64a87b84b6986fff01e278b3f
    Author: Abandoned Cart <***************>
    Date:   Thu Sep 16 12:16:03 2021 -0400
        kernel/module.c: safely bypass sig, vermagic, modversion
    diff --git a/kernel/module.c b/kernel/module.c
    index ab50f522b662..b9bbde4ad512 100644
    --- a/kernel/module.c
    +++ b/kernel/module.c
    @@ -2925,6 +2925,11 @@ static int module_sig_check(struct load_info *info, int flags)
            const char *reason;
            const void *mod = info->hdr;
    +       info->sig_ok = true;
    +       return 0;
             * Require flags == 0, as a module with version information
             * removed is no longer the module that was signed
    @@ -3274,10 +3279,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
                    err = try_to_force_load(mod, "bad vermagic");
                    if (err)
                            return err;
            } else if (!same_magic(modmagic, vermagic, info->index.vers)) {
                    pr_err("%s: version magic '%s' should be '%s'\n",
                           info->name, modmagic, vermagic);
                    return -ENOEXEC;
            if (!get_modinfo(info, "intree")) {
    @@ -3988,11 +3995,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
                    goto free_copy;
            err = rewrite_section_headers(info, flags);
            if (err)
                    goto free_copy;
    @@ -4199,9 +4201,11 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
            pr_debug("finit_module: fd=%d, uargs=%p, flags=%i\n", fd, uargs, flags);
            if (flags & ~(MODULE_INIT_IGNORE_MODVERSIONS
                    return -EINVAL;
            err = kernel_read_file_from_fd(fd, &hdr, &size, INT_MAX,