星期五, 7月 14, 2017
[RaspberryPi] Build kernel for RaspberryPi (二) image [續]
使用fdisk來看image檔裡的結構,
sdcard.img1 是boot partition,包含了bootloader,kernel,和一些rpi的設定檔。
sdcard.img2 是指root file system。
而我要替換掉sdcard.img裡的kernel,
首先我先在 /mnt 下建兩個目錄boot和root,
然後我要把boot partition mount在/mnt/boot ,
把rootfs partition mount在/mnt/root ,
boot partition :
sdcard.img1 * 1 65536 32768 c W95 FAT32 (LBA)
是從1開始到65536 ,
所以是((65536-1)+1)*512 = 33554432 為他這partiton的大小,
起始位址是1*512 = 512 ,
mount -o loop,offset=512,sizelimit=33554432 sdcard.img /mnt/boot
rootfs partition :
sdcard.img2 65537 305536 120000 83 Linux
從65537開始,所以是65537*512 = 33554944
mount -o loop,offset=33554944 sdcard.img /mnt/root
Ref_1
訂閱:
張貼留言 (Atom)




沒有留言:
張貼留言