Pages

Showing posts with label partition. Show all posts
Showing posts with label partition. Show all posts

Thursday, October 5, 2017

Mounting bootable image file under linux with offset

Use fdisk to see the partitions and their offset of the image file:
# fdisk -l router-devuan-jessie-diskless-2017.img
Disk router-devuan-jessie-diskless-2017.img: 3.7 GiB, 3980394496 bytes, 7774208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7b19da02

Device                                                 Boot Start     End Sectors  Size Id Type
router-devuan-jessie-diskless-2017.img    *     2048 7772159 7770112  3.7G 83 Linux
According to fdisk each sector of the image has 512 bytes. We need that so we can calculate the right offset when mounting it.

The image has one linux partition starting at offset of 2048. The right offset is 512*2048.

Here is how to mount it:
# mount -o loop,offset=$((2048*512)) router-devuan-jessie-diskless-2017.img /mnt/

Sunday, December 4, 2011

PowerMac G4/1Ghz with Nvidia GeForce 440mx notes

Just a few notes for OpenFirmware, Xorg configuration. Sources guide-open-firmware-apple-bios-0, xorgconf-powermac-g41ghz-geforce-4-mx-apple-studio-display-17, http://sowerbutts.com/linux-mac-mini/.

OpenFirmware:
  • ls - displays contents of the current path in the device tree.
  • devalias - provides a list of short alias names for key hardware devices.
  • .properties - provides a list of properties for the selected device.
  • pwd - displays the current path within the device tree.
  • dev - selects a device (using either the alias or absolute/relative device tree path).
  • words - provides a list of forth scripts associated with the selected device.
  • source - executes a particular forth script.
  • load - loads a image from disk, cd, network or another device.
  • go - execites the currently loaded image.
  • see - displays the source code for a particular forth script.
Booting installation of Debian GNU/Linux Squeeze 6.0 on PowerMac G4/1Ghz: 
0>boot cd:,\install\yaboot
 Partition disk:
1. Don't touch the small Partition #1 at the start of the disk, that contains the partition map itself.
2. Partition #2 (16MB) is for "yaboot", the bootstrap that allows you to boot

3. Linux or MacOS. You want to tell the partitioner to use that partition as a "NewWorld boot partition", and set the bootable flag.
4. Partition #3 (2.0GB) should be used as "swap area".
5. Partition #4 (48.0GB) is your root filesystem, you want to use that as a "ReiserFS journalling file system", format it, and mount it on "/"
 Booting after installation:
0>setenv boot-file hd:3,\yaboot

Xorg.conf PowerMac G4/1GHz GeForce 4 MX:

Section "Device"
Identifier "Configured Video Device"
BusID   "PCI:0:16:0"
Driver  "nv"
EndSection

Section "Monitor"
    Identifier    "StudioDisplay17"
    Option "DPMS"
    HorizSync   30-80
    VertRefresh   50-100
EndSection

Section "Screen"
    Identifier    "Default Screen"
    Monitor        "StudioDisplay17"
    Device        "Configured Video Device"
        DefaultDepth    24
           SubSection       "Display"
             Depth            24
             Modes             "1280x1024" "1024x768" "800x600" "640x480"
           EndSubSection
           SubSection        "Display"
             Depth            16
             Modes             "1280x1024" "1024x768""800x600" "640x480"
           EndSubSection
SubSection "Display"
      Depth      15
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      8
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      4
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
SubSection "Display"
      Depth      1
      Modes      "1280x1024" "1024x768" "800x600" "640x480"
   EndSubSection
EndSection

Section "ServerLayout"
   Identifier   "Default Layout"
   Screen      "Default Screen"
EndSection

Section "DRI"
   Mode   0666
EndSection