Raspian kernel cross compilation failing - compilation

I want to cross-compile a Raspbian kernel that I downloaded from www.github.com/raspberrypi/linux on my host machine (Linux Mint Cinnamon 64bit).
I was executing the following steps:
Create folders leading to path home/sven/Develop/Raspbian
Cloning repo from link above leading to home/sven/Develop/Raspbian/linux containing the source code
Cleaning kernel by running make mrproper
Creating .config from my running raspberry pi 3B+ by running sudo scp pi#.../proc/config.gz . and then unzipping it with gunzip -c config.gz > .config
Running ARCH=arm CROSS_COMPILE=${CCPREFIX} make oldconfig
grep -v DEBUG_INFO < .config > newconfig
mv newconfig .config
ARCH=arm CROSS_COMPILE=${CCPREFIX} make oldconfig
ARCH=arm CROSS_COMPILE=${CCPREFIX} make
However, the last step is always failing (Error 2 or Error 1). I have also tried the following commands that have also been unsuccessful:
make ARCH=arm CROSS_COMPILE=${CCPREFIX}
make ARCH=arm CROSS_COMPILE=
If I type in only make oldconfig or only make, it works but then I have no idea if it's really compiled for ARM or with the gcc compiler...
My .profile file looks like this at the end:
PATH=/opt/toolchain/.../gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/:$PATH
export CCPREFIX=arm-linux-gnueabihf-
I have already tried the PATH without the "/bin/" at the end, also not working.
Does anyone have an idea???

Related

Error when Compiling Linux Kernel for Android 11 (R) Beta version 1 with clang-r383902

I am using an Ubuntu 20.04 machine with the newest version of platform-tools installed and (I believe) all necessary dependencies.
I created a new directory ~/beta1-kernel-coral and within this directory I cloned the kernel:
git clone -b android-msm-coral-4.14-r-beta-1 https://android.googlesource.com/kernel/msm/
I noticed the clang version used was clang-r383902. I downloaded this directory and extracted it so that I had two separate directories within ~/beta1-kernel-coral: msm and clang-r383902.
From within ~/beta1-kernel-coral/msm, I ran two commands:
make floral_defconfig
make menuconfig
Next, using Nathan Chance's guide from Github, I ran the following command:
PATH="/home/jherwig/beta1-kernel-coral/clang-r383902/android_prebuilts_clang_host_linux-x86_clang-6443078-10.0/bin:/usr/bin:/usr/bin:${PATH}" make -j$(nproc --all) ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android- CROSS_COMPILE_ARM32=arm-linux-androideabi-
The kernel began compiling until I received the following output:
https://pastebin.com/61pkd6uf
In Nathan's guide, he intructs to use:
PATH="<path to clang folder>/bin:<path to 64-bit gcc folder>/bin:<path to 32-bit gcc folder>/bin:${PATH}" \ ...
Since I installed gcc-multilib, I thought <path to 64-bit gcc folder> and <path to 32-bit gcc folder> would be in /usr/bin. When I type which gcc in terminal I get /usr/bin/gcc.
CAF kernels are NOT mainline kernels and you cannot compile them as such. You must run make distclean and specify an out directory for each make command, including the defconfig
Example:
make O=out
If you do not specify O=out for each make command you'll hit these errors
The value assigned to O can be anything, doesn't have to be out but you cannot build the kernel in the same directory as the source
Change this:
make floral_defconfig
make menuconfig
To this:
make floral_defconfig O=out
make menuconfig O=out
The build it with:
make O=out
Remember to make distclean in the source directory first

How to compile openssl with afl-gcc

I need to compile openssl 1.0.1f version with afl-fuzz and then use it in an application to find heartbleed bug. I have done so far;
Go to openssl1.0.1f directory and run following command
./config CC="afl-gcc" CXX="afl-g++"
./config no-shared no-idea no-mdc2 no-rc5 no-comp enable-tlsext no-ssl2
make depend
make && make install
Everything works fine but during compilation I see gcc -I commands compiling files rather than afl-gcc and I donot see Instrumentation details at the end as I see it in simple programs I compile with afl-fuzz. I am not sure openssl has compiled with gcc or afl-gcc. I have also replaced gcc with afl-gcc in Makefile but no result.
Can someone please explain as in all blogs about openssl and afl-fuzz, I have found these commands only.
Thanks.
I was making a simple mistake of calling ./configure after manually making changes to Makefile. Each ./configure command overwrites previous Makefile. So my step should be in following order.
./config no-shared no-idea no-mdc2 no-rc5 no-comp enable-tlsext no-ssl2
make depend
Manually replace every occurrence of `gcc`to `afl-gcc` in Makefile
make && make install
Thanks.

unable to compile u-boot on windows 7 64-bit using cygwin, arm-none-linux-gnueabi-gcc: Command not found

I am facing issue while compiling u-boot for OMAP-L1, I am using cygwin installed on a Windows 7 64-bit OS. when I run make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-Cygwin says make: arm-none-linux-gnueabi-gcc: Command not found what I understood is that this error is because I am using a 64 bit machine and arm-none-linux-gnueabi- is an 32 bit application. to overcome this issue I need to install ia32-libs pkg. But I am not able to find this package under cygwin. Is there is any other way I can compile u-boot on a Windows 7 64-bit or is there any 64-bit arm cross compiler available.
PS. Before these command I used
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- omapl_xxx_config
Me#MyMachine ~/u-boot-omapl1
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make: arm-none-linux-gnueabi-gcc: Command not found
Generating include/autoconf.mk.dep

Error in linux cross compilation u-boot

When i am cross compile u-boot code in ubuntu and gives command as follow
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- distclean
error is:
System not configured -see readme Error[1]
What is solution for this?
thank you.
hardik gajjar
To compile U-Boot, the easiest way is to export the CROSS_COMPILE variable :
$ export CROSS_COMPILE=/directory/.../arm-none-linux-gnueabi-
And then you have to choose the board configuration, for example :
$ make lpc4350-board_config
Then you can compile :
$ make
The distclean target is used to undo/clear any changes made to the local working directory by selecting any board/device-specific config.
The error System not configured -see readme Error[1] indicates that the current u-boot working-directory is NOT yet configured for any device/board and hence the distclean target to make is redundant at this point.

Trouble Making Spooles

I am trying to make Spooles 2.2-9 on Mint Maya linux distro and I get the following error.
aaron#atown ~/Downloads/spooles $ sudo make global
cd A2/src ; make -f makeGlobalLib
make[1]: Entering directory `/home/aaron/Downloads/spooles/A2/src'
makeGlobalLib:19: warning: overriding commands for target `.c.o'
../../Make.inc:90: warning: ignoring old commands for target `.c.o'
/usr/lang-4.0/bin/cc -c -O basics.c -o A2_basics.o
make[1]: /usr/lang-4.0/bin/cc: Command not found
make[1]: *** [basics.o] Error 127
make[1]: Leaving directory `/home/aaron/Downloads/spooles/A2/src'
make: *** [global] Error 2
I am new to linux so any help would be most useful.Thanks
Have you tried installing it from your software package manager? I know that package is provided by Ubuntu and Debian, and Mint is a derivative so it should have it available for installation. No need to build it yourself.
If you do want to compile it yourself, first note you should never build software as root (don't prefix the make command with sudo). It's possible that if there's an install step you'll need to run that as root, but generally not the build.
Second it looks like by default this package is configured to build on OSX (I think /usr/lang-4.0/bin/cc is an OSX path... maybe?). In any event, that's not where the compiler lives on Linux: try this to override the compiler:
make CC=gcc global
It's also possible that your system does not have a compiler installed. If you get an error from the above then use your software package manager to install the gcc package.

Resources