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

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

Đ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

BUILD LINUX KERNEL 2015 Based on EPFL assignment SinhVienZone.com https://fb.com/sinhvienzonevn Prepare for disaster! SinhVienZone.com https://fb.com/sinhvienzonevn Ubuntu 12.04 in Virtual Box   https://www.youtube.com/watch?v=pUxd38Pj3r0 Note:   Hard drive: 20GB Ubuntu 64bit SinhVienZone.com https://fb.com/sinhvienzonevn Compile Kernel, the Ubuntu ways SinhVienZone.com https://fb.com/sinhvienzonevn Videos   https://www.youtube.com/watch?v=Wm3-lBW8o4s https://www.youtube.com/watch?v=cc8082h0fS0 SinhVienZone.com https://fb.com/sinhvienzonevn Tools & source code    $sudo apt-get install dpkg-dev git $sudo apt-get build-dep linux-image-$(uname -r) $git clone git://kernel.ubuntu.com/ubuntu/ubuntuprecise.git  Other options:  Down load code from kernel.org  Use apt-get SinhVienZone.com https://fb.com/sinhvienzonevn Verify and checkout    $cd ubuntu-precise $git tag -l Ubuntu-lts-3.11* $git checkout -b os_assignment_1 Ubuntu-lts-3.11.015.25 SinhVienZone.com https://fb.com/sinhvienzonevn Complie    $sudo apt-get install fakeroot $sudo fakeroot debian/rules clean $sudo fakeroot debian/rules binary-headers binarygeneric SinhVienZone.com https://fb.com/sinhvienzonevn Tips on recompile process   $sudo apt-get install ccache $vi ~/.bashrc       +export CCACHE_DIR="/.ccache" +export CC="ccache gcc“ +export CXX="ccache g++" +export PATH="/usr/lib/ccache:$PATH" $source ~/.bashrc $ccache -M 4G SinhVienZone.com https://fb.com/sinhvienzonevn Voilà 10  $ls /*.deb    /linux-headers-3.11.0-15-generic_3.11.015.25~precise1_amd64.deb /linux-image-3.11.0-15-generic_3.11.015.25~precise1_amd64.deb /linux-tools-3.11.0-15-generic_3.11.015.25~precise1_amd64.deb SinhVienZone.com https://fb.com/sinhvienzonevn Make 17   $sudo make $sudo make modules_install install SinhVienZone.com https://fb.com/sinhvienzonevn Install 18   #make install Result in /boot    System.map-… config-… vmlinuz-… SinhVienZone.com https://fb.com/sinhvienzonevn initrd 19   “initrd images contains device driver which needed to load rest of the operating system later on Not all computer requires initrd, but it is safe to create one” # cd /boot # mkinitrd -o initrd.img-… … SinhVienZone.com https://fb.com/sinhvienzonevn grub 20  # vi /boot/grub/menu.lst title Debian GNU/Linux, kernel … Default root (hd0,0) kernel /boot/vmlinuz root=/dev/hdb1 ro initrd /boot/initrd.img-… savedefault boot SinhVienZone.com https://fb.com/sinhvienzonevn Here it is! 21  # reboot SinhVienZone.com https://fb.com/sinhvienzonevn 22 Add system call SinhVienZone.com https://fb.com/sinhvienzonevn Your first system call! 23   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:   for success (minus) error code otherwise SinhVienZone.com https://fb.com/sinhvienzonevn System call list 24  arch/x86/syscalls/syscall_64.tbl      543 abi: 64, x32, or common entry point: sys_ arch/x86/syscalls/syscall_32.tbl  351 SinhVienZone.com https://fb.com/sinhvienzonevn Header file 25  include/linux/syscalls.h SinhVienZone.com https://fb.com/sinhvienzonevn Source code 26  get_unique_id.c: # include < linux / linkage h> asmlinkage long sys_get_unique_id (int * uuid ) { // your code } SinhVienZone.com https://fb.com/sinhvienzonevn Change Makefile 27  obj-y =  get_unique_id.o SinhVienZone.com https://fb.com/sinhvienzonevn Test 28 # include # include # include # define IS_32_BIT #if IS_32_BIT # define NR_get_unique_id 351 # else # define NR_get_unique_id 543 # endif long get_unique_id ( int* uuid ) { return syscall ( NR_get_unique_id , uuid ) ? errno : 0; } SinhVienZone.com https://fb.com/sinhvienzonevn Test (cont.) 29 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 ); return 0; } SinhVienZone.com https://fb.com/sinhvienzonevn Need help? 30   http://moodlearchives.epfl.ch/20132014/mod/forum/view.php?id=358001 Classmates & tutors! SinhVienZone.com https://fb.com/sinhvienzonevn 31 SinhVienZone.com https://fb.com/sinhvienzonevn ... savedefault boot SinhVienZone. com https://fb .com/ sinhvienzonevn Here it is! 21  # reboot SinhVienZone. com https://fb .com/ sinhvienzonevn 22 Add system call SinhVienZone. com https://fb .com/ sinhvienzonevn... https://fb .com/ sinhvienzonevn Load new kernel 12   $sudo dpkg -i *.deb $sudo reboot SinhVienZone. com https://fb .com/ sinhvienzonevn Verify 13  $uname -a SinhVienZone. com https://fb .com/ sinhvienzonevn... https://fb .com/ sinhvienzonevn Compile Kernel, the Ubuntu ways SinhVienZone. com https://fb .com/ sinhvienzonevn Videos   https://www.youtube .com/ watch?v=Wm3-lBW8o4s https://www.youtube .com/ watch?v=cc8082h0fS0

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

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan