cakeng / SNU_CS_OS_2021_Courseworks

Modified Tizen Linux Source Code. From SNU CS's Operating System courses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README
Use git clone to download source.
Create tizen-image directory and unzip&copy the required image files. (As in proj0)
Enter cloned source directory and git switch to proj4 branch.
The directory structure should look like

dir_root/
------osfall2021-team1-proj4/
------------proj4.fs
------------qemu.sh
------------generate.sh (Automated kernel building and image movement script)
------------kernel/
------------------gps.c  (Define syscall function & gps distance approxiation)
------------------gps_sec_arc_tan.h (table of arc_tan & cos for approximation)
------------------/include/linux
--------------------------------/syscall.h,fs.h,gps.h (add struct about gps data & declare function)
------------arch/arm64/include/asm 
------------------unistd.h (Increased the number of syscalls)
------------------unistd32.h, syscall.h  (Added syscall five locks)
------------------syscall.tbl  (Added syscall set_rotation,locks,unlocks)
------------test/
------------------Makefile (Also mounts & moves binaries into the root image.)
------------------file_loc.c (As guide provides it outputs file location&google links)
------------------gpsupdate.c (update current location to certain coordinate) 
------------------ext2/
----------------------ext2.h (add gps variable in fs)
----------------------file.c (add gps variable when creating file)
----------------------inode.c (load disk data to memory)
----------------------namei.c (set gps data when file creation)
------tizen-image/
------------.img files

------Building the OS------
Enter osfall2021-team1-proj4 and run ./generate.sh to build the kernel. (Requires root privileges)

------Building Test Files------
Enter osfall2021-team1-proj4/test and enter "make". (Requires root privileges)
MAKE ALSO COPIES ../proj4.fs INTO THE ROOT FILESYSTEM IMAGE IN ../../tizen-image 

To run the VM, change directory to osfall2021-team1-proj4 and run ./qemu.sh (Requires root privileges)
After booting run the copied binary in the root user home directory.


Files under proj4.fs (All files empty.)

proj4/
   snu_east - 37.452899, 126.9714, accuracy 20m
   snu_west - 37.45317, 126.92649, accuracy 20m
   snu_downtown/
      snu_kyobo - 37.45933, 126.05056, accuracy 20m
      snu_bogunso - 37.45904, 126.05081, accuracy 20m
      snu_gwanjung - 37.45897, 126.95231, accuracy 20m
   

Test code usage

Please change fs to r/w and mount proj4.fs.
   mount -o rw,remount /dev/mmcblk0p2 /                -mount fs as rw      
   mkdir proj4                                         -create proj4 directory
   mount -o loop -t ext2 /root/proj4.fs /root/proj4    -mount proj4.fs to proj4

./gpsupdate <lat_int> <lat_frac> <long_int> <long_frac> <accuracy>
and frac is alway 6 digit and less than 6 always fill up zero in higher bit for example
   ../gpsupdate 37 452899 126 971400 20 => 37.452899,126.971400
   ../gpsupdate 37 4528 126 9714 20 => 37.004528,126.009714

./file_loc <file_location>
output location info written in file for example
   ../file_loc snu_west 
   [   67.830000] DEBUG: get_gps_location called.
   [   67.830292] DEBUG: get_gps_location complete.
   latitude: 37.453170, longtitude: 126.026490, accuracy: 20 m
   Google_link: www.google.com/maps/search/37.453170,126.926490
and if file is NOT accesible it will return -1m for example
   [   68.397041] DEBUG: get_gps_location called.
   latitude: -1.000001, longtitude: -1.000001, accuracy: -1 m
   Google_link: www.google.com/maps/search/-1.000001,-1.000001

Appoximation

proj4.fs contains two files which is 3.9km apart from each other
snu_east has  37.452899, 126.971400 coordinate
snu_west has  37.453170, 126.926490 coordinate

when approximation we needed to measure longtitude distance and latatitude distance
a) longtitude distance was calculated by multiplying longtitude angle diffrence with radius of earth
   -assumption 1) ignore the altitude
   -assumption 2) let arc of circle approximate to straight line
b) latitude distance was calculated by 
   get average latitude of two dot
   multiply radius with longitude diff
   -assumption 1) longitude diff does not make each radius too far from each other so that we can approximate two
                  dot as points on circle which has centen on the axis of rotation
   -assumption 2) let arc of circle approximate to straight line
c) pythagoras
   for this calculation instead of using root
   we used arctan and cos with gps_sec_arc_tan.h
   and since we have two distance diff we can calculate
   x/cos(arctan(x/y))
   which is same as (x^2 + y^2)^0.5
detaled pictures on ppt


Test code usage example

   mount -o rw,remount /dev/mmcblk0p2 /                -mount fs as rw      
   mkdir proj4                                         -create proj4 directory
   mount -o loop -t ext2 /root/proj4.fs /root/proj4    -mount proj4.fs to proj4
   cd proj4                                            -enter proj4
   ../gpsupdate 37 452899 126 971400 20                -set gps to certain location
   touch snu_east                                      -make file with coords 37.452899 126.9714, accuracy 20m
   ../gpsupdate 37 453170 126 926490 20                -new location
   touch snu_west                                      -make file with coords 37.45317 126.92649, accuracy 20m
   cat snu_east                                        -permission denied
   cat snu_west                                        -permission granted
   ../file_loc snu_west                                -return proper location&link
   ../file_loc snu_east                                -return -1m acc

About

Modified Tizen Linux Source Code. From SNU CS's Operating System courses.

License:Other


Languages

Language:C 96.7%Language:Assembly 2.6%Language:Makefile 0.3%Language:Perl 0.1%Language:Shell 0.1%Language:Python 0.1%Language:C++ 0.0%Language:Yacc 0.0%Language:SmPL 0.0%Language:Roff 0.0%Language:Awk 0.0%Language:Lex 0.0%Language:GDB 0.0%Language:UnrealScript 0.0%Language:Gherkin 0.0%Language:Raku 0.0%Language:M4 0.0%Language:Clojure 0.0%Language:XS 0.0%Language:sed 0.0%