1. Trang chủ
  2. » Giáo án - Bài giảng

kỹ thuật điện hệ điều hành os+thí nghiệm +build+kernel+pub sinhvienzone com

31 39 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 31
Dung lượng 333,91 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Prepare for disaster!2 SinhVienZone.com https://fb.com/sinhvienzonevn... Compile Kernel, the Ubuntu ways4 SinhVienZone.com https://fb.com/sinhvienzonevn... Tools & source code $sudo apt

Trang 1

BUILD LINUX KERNEL

Based on EPFL assignment

2015

Trang 2

Prepare for disaster!

2

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 3

Ubuntu 12.04 in Virtual Box

Trang 4

Compile Kernel, the Ubuntu ways

4

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 5

 https://www.youtube.com/watch?v=Wm3-lBW8o4s

 https://www.youtube.com/watch?v=cc8082h0fS0

5

Trang 6

Tools & source code

 $sudo apt-get install dpkg-dev git

 $sudo apt-get build-dep linux-image-$(uname -r)

 $git clone precise.git

Trang 7

Verify and checkout

 $cd ubuntu-precise

 $git tag -l Ubuntu-lts-3.11*

 $git checkout -b os_assignment_1 15.25

Ubuntu-lts-3.11.0-7

Trang 8

 $sudo apt-get install fakeroot

 $sudo fakeroot debian/rules clean

 $sudo fakeroot debian/rules headers generic

binary-8

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 9

Tips on recompile process

 $sudo apt-get install ccache

Trang 10

 $ls /*.deb

 15.25~precise1_amd64.deb

/linux-headers-3.11.0-15-generic_3.11.0- 15.25~precise1_amd64.deb

/linux-image-3.11.0-15-generic_3.11.0- 15.25~precise1_amd64.deb

/linux-tools-3.11.0-15-generic_3.11.0-10

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 12

Load new kernel

 $sudo dpkg -i *.deb

 $sudo reboot

12

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 13

 $uname -a

13

Trang 14

Compile kernel, geeky ways

14

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 15

Get kernel source

 $uname –a

 $wget 3.11.5.tar.xz

https://www.kernel.org/pub/linux/kernel/v3.x/linux- $tar xjvf 3.11.5.tar.xz

15

Trang 16

 $sudo apt-get install ncurses-dev

 Ncurse: toolkit for developing "GUI-like" application software that runs under a terminal emulator.

 $sudo make menuconfig

 (Use old config: sudo make oldconfig)

16

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 20

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 21

Here it is!

 # reboot

21

Trang 22

Add system call

22

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 23

Your first system call!

 Return a system wide unique identier each time it is called

 sys_get_unique_id (int * uuid )

 uuid: location to store the unique identifier after the call

 return:

 0 for success

 (minus) error code otherwise

23

Trang 24

System call list

Trang 25

Header file

 include/linux/syscalls.h

25

Trang 26

Source code

 get_unique_id.c:

# include < linux / linkage h>

asmlinkage long sys_get_unique_id (int * uuid ) {

// your code }

26

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 27

Change Makefile

 obj-y =

 get_unique_id.o

27

Trang 28

long get_unique_id ( int* uuid ) {

return syscall ( NR_get_unique_id , uuid ) ? errno : 0; }

28

SinhVienZone.com https://fb.com/sinhvienzonevn

Trang 29

Test (cont.)

int main () {

int uuid ; int res;

res = get_unique_id (& uuid );

printf (" Syscall returned %d, uuid is %d\n", res , uuid ); res = get_unique_id (& uuid );

printf (" Syscall returned %d, uuid is %d\n", res , uuid ); res = get_unique_id (47424742); // arbitrary memory address

printf (" Syscall returned %d\n", res );

29

Ngày đăng: 28/01/2020, 22:10

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm