some stuff
some stuff
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).
PART 3: PROCESS
Write a program in C to create a parent process P1. The parent process P1 forks a child (named P2) and waits for the
child to complete the program multiplicationtable. The child process prints its pid, executes the multiplicationtable
program and then exits. The multiplicationtable gets an argument arg and prints the arg times table. When P2 is
finished, P1 prints the information of P2 including pid and the exit state, and then exits.
-Go to the home directory
# cd ~
-Create a file process.c using gedit editor
# gedit process.c