내 환경
~$ uname -a
Linux ubuntu-linux-22-04-desktop 5.15.0-41-generic #44-Ubuntu SMP Thu Jun 23 11:20:13 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
1. 커널 소스 다운로드 받기
$ cd /usr/src
/usr/src$ wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.27.tar.xz
/usr/src$ tar -xvf linux-6.12.27.tar.xz
1.5. 문서 읽기
⭐ 커널 컴파일을 시도하면서 문서를 읽는 것이 매우 중요하다는 걸 뼈저리게 느꼈습니다. 블로그 보지 말고 문서 보십쇼. 문서!
README
Documentation/admin-guide/README.rst
https://www.kernel.org/doc/html/latest/
Documentation/process/changes.rst
1.5.1 README
를 읽으면
- Documentation/admin-guide/README.rst (먼저 읽기)
- https://www.kernel.org/doc/html/latest/ (인터넷으로 읽기)
- Documentation/process/changes.rst (it contains the requirements for building and running the kernel)
를 읽어야 한다는 것을 알 수 있습니다.
1.5.2 Documentation/admin-guide/README.rst
1.5.3 Documentation/process/changes.rst
터미널에 하나하나 쳐가며 업데이트 시켜주거나, 다운로드 받았습니다.
/usr/src/linux-6.12.27/certs/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
21 | #include <openssl/bio.h>
| ^~~~~~~~~~~~~~~
이후 에러가 발생하여 libssl-dev를 인스톨해주었습니다.
sudo apt install libssl-dev
일단 설치하시는 것을 추천 👍
2. kernel compilation
kernel source code: /usr/src/linux-6.12.27
build directory: /home/name/build/kernel
cd /usr/src/linux-6.x
make O=/home/name/build/kernel defconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel modules_install install
# 작업 디렉토리는 /usr/src/linux-6.12.27
# root 권한으로 실행
/usr/src/linux-6.12.27$ make O=/home/{user}/build/kernel defconfig
# ~/build/kernel 은 직접 디렉토리를 생성해주면 됩니다.
/usr/src/linux-6.12.27$ make O=/home/{user}/build/kernel -j$(nproc)
# -j$(nproc) 은 컴파일을 코어 수만큼 병렬로 처리하게 해주는 옵션입니다.
make 중간에 발생한 오류입니다.
/usr/src/linux-6.12.27/certs/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
21 | #include <openssl/bio.h>
| ^~~~~~~~~~~~~~~
병렬로 처리하고 있다보니 error가 발생해도 바로 컴파일이 종료되지 않을 수 있습니다.
그래서 저는 이상한 거 뜨면 ^C로 인터럽트 걸어버렸습니다.
sudo apt install libssl-dev
인스톨 후 다시 make 해주었습니다.
⭐완료⭐
아무튼 컴파일이 완료되었습니다.
/usr/src/linux-6.12.27$ make O=/home/{user}/build/kernel modules_install install
더보기
INSTALL /lib/modules/6.12.27/kernel/net/qrtr/qrtr-mhi.ko
DEPMOD /lib/modules/6.12.27
INSTALL /boot
run-parts: executing /etc/kernel/postinst.d/dkms 6.12.27 /boot/vmlinuz-6.12.27
* dkms: running auto installation service for kernel 6.12.27
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j2 KERNELRELEASE=6.12.27 -f Makefile.kmods KSRC=/lib/modules/6.12.27/build KVER=6.12.27...(bad exit status: 2)
ERROR (dkms apport): binary package for parallels-tools: 18.3.3.53627 not found
Error! Bad return status for module build on kernel: 6.12.27 (aarch64)
Consult /var/lib/dkms/parallels-tools/18.3.3.53627/build/make.log for more information.
[ OK ]
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 6.12.27 /boot/vmlinuz-6.12.27
update-initramfs: Generating /boot/initrd.img-6.12.27
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 6.12.27 /boot/vmlinuz-6.12.27
run-parts: executing /etc/kernel/postinst.d/update-notifier 6.12.27 /boot/vmlinuz-6.12.27
run-parts: executing /etc/kernel/postinst.d/xx-update-initrd-links 6.12.27 /boot/vmlinuz-6.12.27
I: /boot/initrd.img is now a symlink to initrd.img-6.12.27
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 6.12.27 /boot/vmlinuz-6.12.27
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.12.27
Found initrd image: /boot/initrd.img-6.12.27
Found linux image: /boot/vmlinuz-5.15.0-41-generic
Found initrd image: /boot/initrd.img-5.15.0-41-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
make[1]: Leaving directory '/home/parallels/build/kernel'
/usr/src/linux-6.12.27#
ERROR가 뜨는데 parallels 환경으로 인한 문제 같고,
일단 "done"이 떴길래 희망적인 마음을 가지고
$ reboot
initramfs에 진입했습니다.
⭐ 아무튼 커널 빌드 성공 ⭐ 입니다.

'HOME' 카테고리의 다른 글
LinuxSP - Standard I/O Library: 함수 (0) | 2025.04.25 |
---|---|
LinuxSP - Files and Directories: 함수 (0) | 2025.04.25 |
LinuxSP - Files and Directories: 개념 (0) | 2025.04.25 |
LinuxSP - FILE I/O: 함수 (0) | 2025.04.24 |
LinuxSP - FILE I/O: 개념 (0) | 2025.04.24 |