mediatek-preloader-tools icon indicating copy to clipboard operation
mediatek-preloader-tools copied to clipboard

Compiling under Linux

Open Ierlandfan opened this issue 8 years ago • 1 comments

If you want to compile under Linux (For example Debian Jessie) you wil run into some errors. First: If you're getting

"error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘uint64_t"

Then you are probably using i386 distro (32Bit)

Quick fix: Use a 64Bit version.

Lazy fix, those format errors are actually warnings and probably harmless for execution , turn off all warnings being treated as errors in gcc. (Please edit if you found that flag responsible for that, I took the quick fix route)

Final fix:

sudo nano +128 mediatek_inject.c change the lines around line 124 to look like these:

#ifndef __APPLE__
        snprintf(ext2fs_name, sizeof(ext2fs_name),"%p?%lld", port, partition_offset);
#else
        snprintf(ext2fs_name, sizeof(ext2fs_name), "%p?%lld", port, partition_offset);

sudo nano +124 mediatek_preloader.c change the lines around line 124 to look like these:

#ifndef __APPLE__
    printf("%09llX:   0%%", offset);
#else
    printf("%09llX:   0%%", offset);

Second: If you run into some ext2fs errors, even after installing extfs- extfs-dev en e2fsprogs:

error: implicit declaration of function ‘ext2fs_ (some-missing-function)’ [-Werror=implicit-function-declaration]

you probably forgot to recursive clone

sudo git clone --recursive https://github.com/androidrbox/mediatek-preloader-tools.git

Ierlandfan avatar Jan 26 '17 15:01 Ierlandfan

sudo git clone --recursive https://github.com/androidrbox/mediatek-preloader-tools.git

Why would you git clone as root?

AreYouLoco avatar Jan 01 '20 18:01 AreYouLoco