这是一个美国的C语言操作系统作业代写
As with previous assignments, we will be using GitHub to distribute skeleton code and collect
submissions. Please refer to our Git Workflow guide for a more details. Note that we will be using
multiple tags for this assignment: one for each deliverable part.
For students on ARM Mac computers (e.g. with M1 chip): if you want your submission to be
built/tested for ARM, you must create and submit a file called .armpls in the top-level directory of
your repo; feel free to use the following one-liner:
cd “$(git rev-parse –show-toplevel)” && touch .armpls && git add .armpls && git commit -m “ARM
You should do this first so that this file is present in all parts.
Code Style
There is a script in the skeleton code named run_checkpatch.sh . It is a wrapper over
linux/scripts/checkpatch.pl , which is a Perl script that comes with the linux kernel that checks if
your code conforms to the kernel coding style.
Execute run_checkpatch.sh to see if your code conforms to the kernel style – it’ll let you know what
changes you should make. We recommend you make those changes.
Passing run_checkpatch.sh with no warnings and no errors is NOT required for this assignment, but
will be for the next one. We recommend you get familiar with this workflow now: run the script and fix
what it suggests before pushing a tag.
Part 1: Building a Kernel in Debian Linux
Reading
LKD chapter 2 (previously assigned)
Task
Kernel Compilation in Debian Linux
First, follow the above guide and compile yourself a pristine (unmodified) kernel from the 5.10.57
Linux source provided in the skeleton repo. You should name it 5.10.57-cs4118 , and keep it around
as your fallback kernel for all future assignments (including this one), in case you run into any trouble
booting into the kernel you’re working on.
Additionally, make sure that the CONFIG_BLK_DEV_LOOP option is set to y in your .config file before
you build and install your pristine kernel. This will come in handy in later assignments.
Part 2: Reducing Kernel Build Time
In this part, you will reduce your kernel build time drastically.
Tasks
localmodconfig
A large amount of time is spent compiling and installing kernel modules you never use. You can
regenerate .config so that it contains only those modules you are currently using. This will drastically
cut down the number of modules. This is how:
1. First, backup your .config to something like .config.<UNI>-from-lts .
Make sure to keep your local version the same as what it was in part 1; that is, your kernel
should still be named 5.10.57-cs4118 .
2. Run make localmodconfig in your Linux kernel source tree.
This will take your current .config and turn off all modules that you are not using.
It will ask you a few questions. You can hit ENTER to accept the defaults, or just have yes do
so for you:
$ yes ” | make localmodconfig
Make sure that CONFIG_BLK_DEV_LOOP is still set to y before building and installing this
kernel.