I don't have specific experience with ClearLinux, but it looks like you can:
# It's best to first compile their gcc (https://github.com/clearlinux-pkgs/gcc)
mkdir ~/patched_source
git clone https://github.com/clearlinux-pkgs/linux ~/clearlinux_patches
cd ~/clearlinux_patches
./scripts/develop.sh linux.spec ~/patched_source
That should download the upstream kernel to a folder below ~/patched_source (it will tell you the exact name) and apply ClearLinux's own patches and default config
.
You can then proceed to compile the kernel as usual, for instance:
cd that_folder
CC=/the/clearlinux/gcc make -j4 bindeb-pkg
# This will take a while and create a few linux-xxx.deb files in the parent directory
sudo dpkg -i ../*.deb # Or just the latest
Disabling the CONFIG_RETPOLINE mitigation makes it possible to compile with Ubuntu's gcc (at a cost, obviously).
The usual warnings apply: try in a VM first, secure boot can be tricky, there might be some Ubuntu-specific patches missing, ...
If you feel adventurous you can also add some of their own cmdline options to /etc/default/grub
(like the ones in lines 8-15)
The only solution that worked for me is:
Manual installing of .deb packages
(sad programmer noises)
- Go to http://old-releases.ubuntu.com/ubuntu/pool/universe/g/
- Download all .deb packages for gcc compiler version you want, f.e.:
gpc-2.1-3.4_3.4.6-6ubuntu5_amd64.deb
cpp-3.4_3.4.6-6ubuntu5_amd64.deb lib32g2c0_3.4.6-6ubuntu5_amd64.deb
g++-3.4_3.4.6-6ubuntu5_amd64.deb libg2c0_3.4.6-6ubuntu5_amd64.deb
g77-3.4_3.4.6-6ubuntu5_amd64.deb libg2c0-dev_3.4.6-6ubuntu5_amd64.deb
gcc-3.4_3.4.6-6ubuntu5_amd64.deb libstdc++6-dbg_3.4.6-6ubuntu5_amd64.deb
gcc-3.4-base_3.4.6-6ubuntu5_amd64.deb libstdc++6-dev_3.4.6-6ubuntu5_amd64.deb
- Manually install them by running command, f.e.:
sudo dpkg -i ./gcc-3.4-base_3.4.6-6ubuntu5_amd64.deb
sudo dpkg -i ./cpp-3.4_3.4.6-6ubuntu5_amd64.deb
sudo dpkg -i ./gcc-3.4_3.4.6-6ubuntu5_amd64.deb
and so on...
Check the console output errors about package dependencies to figure out the package install order.
- If you encounter error (bug probably) about crossdependency of "g++..." package to "libstdc++..." package and v.v. then run install command to update libstdc++ package with exact version number, f.e.:
sudo apt-get install libstdc++6
- Hooray! Use installed gcc (g++) version by, f.e.:
g++-3.4 -v
P.S.: of you're getting missing libs errors try
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH
before the build
Best Answer
Thanks to @Raffa and i hope @Raffa writes the answer here so i will award him the award.