Nowadays, aarch64 architecture is used by many system and security developers. Sometimes, the developer may need an ARM development board to build, test and customize the Linux kernel.
As aarch64 instances are available in OCI (Oracle Cloud Infrastructure), in this article, we are going to demonstrate the procedure to build the Linux kernel (v6.6) on OCI and Oracle Linux 8. The developers will be able to use Oracle Linux and OCI for their ARM development/research projects.
Step 1. Create the instance
In this article our Oracle Linux 8 instance is an OCI VM.Standard.A1.Flex instance, with 16 OCPUs and paravirtualized networking.
Step 2. Setup the environment
Please install required packages.
$ sudo yum install gcc-toolset-13 openssl-devel flex bison
In order to use gcc-13 we need to enable the gcc-toolset-13 software collection:
$ scl enable gcc-toolset-13 bash
Please double check that the gcc version is 13.1.1.
$ gcc -v ... ... gcc version 13.1.1 20230614 (Red Hat 13.1.1-4) (GCC)
To ensure this software collection is enabled permanently across logins, add the above scl command to /etc/profile.
Step 3. Download source code
We will use linux-6.6 in this article.
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.6.tar.xz
Step 4. Build and Install
Apply the additional config options and run 16 jobs in parallel during the build (as indicated by -j16). If for instance you had 32 CPUs available, you could specify -j32.
$ tar xvf linux-6.6.tar.xz $ cd linux-6.6/ $ make defconfig $ scripts/config --file ".config" -m CONFIG_SCSI_VIRTIO \ -m CONFIG_XFS_FS -m CONFIG_ISCSI_TCP -m CONFIG_ISCSI_BOOT_SYSFS $ make olddefconfig $ make -j16 > /dev/null $ sudo make modules_install $ sudo make install
Step 5. Configure and Reboot
Increase the loglevel to 7 by editing /etc/default/grub, and then re-generate grub. This helps diagnose if any hang/panic events occurred during kernel boot.
You may need sudo su to switch to the root user.
$ cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_DISABLE_RECOVERY="true" GRUB_ENABLE_BLSCFG=true GRUB_TERMINAL="console" GRUB_CMDLINE_LINUX="crashkernel=auto LANG=en_US.UTF-8 console=ttyAMA0 console=ttyAMA0,115200 rd.luks=0 rd.md=0 rd.dm=0 rd.lvm.vg=ocivolume rd.lvm.lv=ocivolume/root rd.net.timeout.carrier=5 netroot=iscsi:169.254.0.2:::1:iqn.2015-02.oracle.boot:uefi rd.iscsi.param=node.session.timeo.replacement_timeout=6000 net.ifnames=1 nvme_core.shutdown_timeout=10 ipmi_si.tryacpi=0 ipmi_si.trydmi=0 libiscsi.debug_libiscsi_eh=1 loglevel=7 ip=dhcp,dhcp6 rd.net.timeout.dhcp=10 crash_kexec_post_notifiers" root# grub2-mkconfig > /boot/efi/EFI/redhat/grub.cfg
Set the default boot kernel in grub to linux-6.6.
root# grubby --set-default /boot/vmlinuz-6.6.0 The default is /boot/loader/entries/79132705173849668b23bf8bf274fdbc-6.6.0.conf with index 0 and kernel /boot/vmlinuz-6.6.0
Verify the kernel version is 6.6 after reboot.
$ uname -r 6.6.0
Summary
We have demonstrated the procedure to build the linux-6.6 kernel on an OCI aarch64 instance and Oracle Linux 8.