Professional Documents
Culture Documents
Submission:
- A report describes clearly how did you solve problems
- All programs (in both kernel-level codes and user-level codes for testing) with comments (DON’T ZIP the
files)
*** Note: At the first step, it will be better if you install an old version of OS kernel. Then, the process of
building a new Linux kernel will be clear
3. Visit http://kernel.org and download the source code of your current running kernel. Then, download a new kernel
from https://www.kernel.org/ (e.g., 5.19.17) and extract the source:
# wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.19.17.tar.xz
tar – tar used to store and extract files from a tape or disk archive
-x – extract files from an archive
-v – requested additional information about the process using the -verbose option when extracting archives
-f – to work with a specific archive file or device archive followed by the name of the archive
-C – to extract files to a particular directory followed by the directory path (in this case /usr/src/)
-After exiting the configuration menu, the generated configuration file is stored in the .config file in the kernel source
directory. This file contains all the configuration options selected or enabled by the user, as well as default options that
are selected by the kernel build system. This file is used by the kernel build system to compile the kernel with the
desired configuration options.
-When I run make menuconfig it will show that error is “Your display is too small to run Menuconfig!”
=> Increase the size of terminal window by dragging the corners until it is large enough to display the entire menu
configuration interface. Change from 1792x1344(4:3) to 1920x1440(4:3) to fix it.
-In your kernel configuration file you will find this line:
CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"
Change it to this:
CONFIG_SYSTEM_TRUSTED_KEYS=""
-Another key has been added to the default Canonical kernel configuration:
CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"
So, it also needs to change to this:
CONFIG_SYSTEM_REVOCATION_KEYS=""
- It is necessary to make these changes because they ensure that the kernel compilation process runs smoothly without
encountering any errors or issues. The first change specifies not to include extra trusted X.509 keys into the kernel,
which can cause issues while verifying kernel modules. The second change specifies not to include any system
revocation keys.
-The warning message indicates that the stack frame size of a particular function is larger than the recommended limit
of 1024 bytes. In this case, the function in question has a stack frame size of 1136 bytes, which exceeds this limit, and
hence the warning is generated. When you have made the changes with some commands I have mentioned above, it
will run normal and no longer have the error.
-Compiling the kernel: The command make -j6 compiles the kernel with 6 threads using the make command. The -j6
option specifies that we want to use 6 threads to speed up the compilation process.
F. REBOOT VM
1. Reboot to the new kernel
# reboot
We add a simple system call helloworld to the Linux kernel. The system call prints out a “Hello! My name is XXX”
message to the syslog (XXX is your student name and your student ID). You need to implement the system call in the
kernel and write a program at the user-level to test your created system call.
-
-Run the following commands in linux-5.19.17/ directory and you will get a file like the following
# cd arch/x86/entry/syscalls/
# gedit syscall_64.tbl
You need to install these packages before compiling the kernel because they are required dependencies
for building the kernel. The kernel build process relies on a number of tools and libraries, including a C
compiler (gcc), libraries for handling terminal input (libncurses5-dev), a parser generator (bison), a
lexical analyzer generator (flex), libraries for handling SSL encryption (libssl-dev), and libraries for
handling object files (libelf-dev). Additionally, updating and upgrading your system ensures that you
-After configuring the kernel, the "sudo make -j6" command is used to compile the kernel. This command can
take a long time to complete, so you can use the "sudo make -j6" command to speed up the process by using
multiple cores on your system.
-Once the kernel has been compiled, you need to install and update it using the "sudo make modules_install
install" command
-After rebooting you can verify the kernel version using the following command:
# reboot
# uname -r
-It will display the kernel version like: 5.19.17
-Go to your home directory and create a userspace.c file
# cd ~
# gedit userspace.c
-Write the following code in this file (remember the number of system call that I wrote in syscalls_64.tbl was
548).
Implement a print_self system call such that this system call will identify the calling process at the user-level and print
out the Process id, running state, and program name.
HINT: https://linuxgazette.net/133/saha.html
-The error message "Failed to execute child process “dbus-launch” (No such file or directory)" indicates that a program
or process attempted to execute the 'dbus-launch' command, but the command was not found on the system.
The command may not be installed on your system. You may need to install it using your system's package
manager.
# sudo apt-get install -y dbus-x11
You need to install these packages before compiling the kernel because they are required dependencies
for building the kernel. The kernel build process relies on a number of tools and libraries, including a C
compiler (gcc), libraries for handling terminal input (libncurses5-dev), a parser generator (bison), a
lexical analyzer generator (flex), libraries for handling SSL encryption (libssl-dev), and libraries for
handling object files (libelf-dev). Additionally, updating and upgrading your system ensures that you
have the latest versions of all the necessary packages installed, which can help avoid compatibility issues
during the kernel build process.
-To configure your kernel use the following command in your linux-5.19.17/ directory
=> You need to follow these steps in order to configure and compile the Linux kernel for your system. The
"sudo make menuconfig" command allows you to customize the kernel configuration by selecting specific
options and settings. It is important to ensure that the file system menu includes the "ext4" option, which is a
widely used file system for Linux.
-Once the kernel has been compiled, you need to install and update it using the "sudo make modules_install
install" command
-After rebooting you can verify the kernel version using the following command:
# reboot
# uname -r
-It will display the kernel version like: 5.19.17
-To check the message of your kernel run the following command:
# sudo dmesg
This will display like this at the end of the kernel’s message.
My current PID: 2009
My programme name: a.out
My running state: runnable
Cleaning up.
Example: the number of processes provided by a user is n=3. Then, the user provides parameters of processes as 1 0 2
1 3 2 2. The output of the program will be as following: