Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# no .mod files
*.mod*

# no .o files.
*.o

# no .cmd files.
*.cmd

# no .symvers files.
*.symvers

# no .order files.
*.order

13 changes: 13 additions & 0 deletions task1-simple-program/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Simple c program with commits
The main idea of of this task is to demonstrate your ability to work with git and create correctly formed commit.
So, you have to focus on the rules and principals of working with github, not on code complexity.
## Task
1. Please, write simple game "guess a number". User input some number from 0 to 9. Computer also generates random number from 0 to 9. If values are equal, user will get message “You win”. In other case – “You loose”. main() function should return 0 if you win, and non-zero value otherwise.
2. When you working on code, please divide it on several steps. Each steps will be new commit. There are possible steps:
a. Create simple *.c file with empty main() function
b. Write main functionality
c. Rewrite code, that random number generates in you own defined function.
3. Check coding style with checkpatch.pl
4. Also don't forget to create .gitignore file
5. Create pull request to this repo into you own branch (have to be already exist)
6. Good luck
9 changes: 9 additions & 0 deletions task2-bash/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Part 2. Bash
The main idea of this task is to increase you level of bash-scripting.

## Task
1. Please write a bash script that is copping all source code of your project form part1 to /tmp/guesanumber. Compress this folder to gzip archive (please google tar command) with same name. Copy gzip archive to “release” subdirectory in project dir. Please, don't forget to divide script on commits.
2. Please write another script, which run program "guess a number" from task1 in infinity loop, and each iteration ask user to press "y" to continue, "n" to exit, or number to set number of runs of tries without asking "y or n". Script counting users success cases and printing it numbers. Also after each success script says "Good job", otherwise "Wish a good luck next time". Please, don't forget to divide script on commits.
3. Make a pull request.
4. If you want, you may use colors to increase readability of script output.
5. Good luck
15 changes: 15 additions & 0 deletions task3-make/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Part 3. Make
The main idea of this task in improve your skills in writing Makefiles.

## Task

1. Please, divide your source code form Task1 into two source file. First one should contains the main() function. Other one contains all other code. Write a Makefile for your project.
2. Implement options to build your project with gcc or clang
3. Implement options to link second files in regular way, static library (.a) or dynamic library (.so).
4. Implement option to check all project code using checkpatch.pl or cppcheck
5. Implement option to include debug information.
6. Implement option to print all warning during compilation.
7. Implement "clean" options.
8. Submit this Makefile with all code to github as pull request. Don't forget commit each step.
9. Good luck
11 changes: 11 additions & 0 deletions task4-simple-driver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ifneq ($(KERNELRELEASE),)
# Kbuild part of makefile
obj-m := hello.o
else
# build for current kernel if KDIR is not specified
KDIR ?= /lib/modules/`uname -r`/build
default:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
$(MAKE) -C $(KDIR) M=$(PWD)
endif
35 changes: 35 additions & 0 deletions task4-simple-driver/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/init.h> // Macros used to mark up functions e.g., __init __exit
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/kernel.h> // Contains types, macros, functions for the kernel

MODULE_LICENSE("GPL"); ///< The license type -- this affects runtime behavior
MODULE_AUTHOR("Name Surname"); ///< The author -- visible when you use modinfo
MODULE_DESCRIPTION("Description"); ///< The description -- see modinfo
MODULE_VERSION("0.1"); ///< The version of the module

static int op1 = -1;
static int op2 = -1;

module_param(op1, int, 0660);
MODULE_PARM_DESC(op1, "First parameter of type s32");

module_param(op2, int, 0660);
MODULE_PARM_DESC(op2, "Second parameter of type s32");

static int __init hello_init(void)
{
pr_info("HELLO: Hello Kernel!\n");
pr_info("HELLO: Sum of parameters = %d\n", op1 + op2);
pr_info("HELLO: Difference of parameters = %d\n", op1 - op2);
pr_info("HELLO: Product of parameters = %d\n", op1 * op2);
return 0;
}

static void __exit hello_exit(void)
{
pr_info("HELLO: Goodbye Kernel!\n");
}

module_init(hello_init);
module_exit(hello_exit);
Binary file added task4-simple-driver/hello.ko
Binary file not shown.