Freebsd

Freebsd boot process

Why compile kernel

for booting /running on hardware with limited resources
for testing a patch and provide feedback to devs
for diabling sth when there is a conflict
to support my unsupported hardware

Smashing The Stack For Fun And Profit

def:paper attempts to explain what buffer overflows are, and how their exploits work.

something useful but not directly related:
virtual memory
experience with gdb

On many C implementations it is possible to corrupt the execution stack by writing past the end of an array declared auto in a routine. Code that does this is said to smash the stack, and can cause return from the routine to jump to a random address.

How did unix/linux identify a file?

前言:在windows中,一個檔案後面都會附帶一串由一個點和一串文字所組成的後綴,這個機制稱為副檔名,for example:.txt、.word等,這個機制讓作業系統能夠辨識一個檔案的特徵和做更進一步的使用,而在unix/linux並沒有附檔名的機制,那linux是使用什麼樣的方式來辨別一個檔案?

Definition

meta data embedded in the file itself that identifies the file type
被嵌入在檔案中用來偵測檔案類別的元資料。
可以使用file(1)命令來檢查一個檔案的格式。

man magic

what is rc file?

  • def: a data placement structure that determines how to store relational tables on computer clusters

Nvidia drivers install

nvidia-xconfig will make xorg totally render on the display card.If we got two display driver,nvidia-xconfig will make an xorg.conf and take over the control of the display.

nvidia-xconfig

What I have done this week

I created a bugzilla account

ports dependancy

I accidentally break my dependancy on gettext

Example 3. Failover Mode Between Ethernet and Wireless Interfaces

顯卡安裝

先安裝intel核心顯卡驅動i915kms,

pkg install drm-kmod

安裝顯卡後分為兩種情況,是否支援獨顯直連,如果不支援,需要先安裝i915kms在安裝

$ pkg install nvidia-hybrid-graphics $ pkg install nvidia-secondary-driver $ pkg install nvidia-secondary-driver $ sysrc kld_list+=nvidia-modeset $ sysrc nvidia_xorg_enable=YES $ nvrun 程式名稱 # 無GUI執行 $ nvrun-vgl 程式名稱# 以GUI 執行

獨顯直連:

pkg install nvidia-driver nvidia-settings nvidia-xconfig nvidia-drm-kmod
sysrc kld_list+="nvidia-modeset nvidia-drm.ko" 

最後可以安裝mesa-demos作為測試
nvrun-vgl bounce

Mounting iso image

$ mdconfig freebsd.iso
md0
$ mount_cd9660 /dev/md0 /mnt/iso
$ umount /mnt/iso
$ mdconfig -d /dev/md0

Generating iso image (debian)

# Install required tools
pkg install gcpio cdrkit-genisoimage

# Download Debian iso image and untar
fetch https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso
tar -C isofiles -xf debian-12.5.0-amd64-netinst.iso

# Feed preseed if needed
chmod -R +w isofiles/install.amd/
gunzip isofiles/install.amd/initrd.gz
echo preseed.cfg | gcpio -H newc -o -A -F isofiles/install.amd/initrd
gzip isofiles/install.amd/initrd
chmod -R -w isofiles/install.amd/

# Generate hash
chmod +w isofiles/md5sum.txt
find -L isofiles -type f ! -name isofiles/md5sum.txt -print0 | xargs -0 md5 | tee isofiles/md5sum.txt
chmod -w isofiles/md5sum.txt

# Generate image
cd isofiles
genisoimage -r -J -b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o preseed-debian-12.5.0-netinst.iso .

network server

Inetd

  • Super-Server

  • only needs to start inetd for many other application

  • when connection to a service managed by inetd,

    • inetd decides destination and spawns a process for that program, and delegates the program a socket.
  • Using inetd for services that are not heavily used can reduce system load, when compared to running each daemon individually in stand-alone mode.