手机版
你好,游客 登录 注册
背景:
阅读新闻

打造永无止境!在iPod中安装Linux操作系统

[日期:2008-01-01] 来源:Linux公社  作者:Linux [字体:大 中 小]

  30G的硬盘共3648个cylinder,分为两个分区:

  1. 前10个cylinder是第一个分区,被用来存放引导信息和Apple的IPOD操作系统,在Windows下不可见。

  2. 后面的是第二个分区,也就是你在Window下看到的那个“可移动磁盘(ipod要设置在disk mode)”,是FAT32格式。

  为了保持和iPod原先的系统共存,类似双系统,那么我们接下来要做的工作流程是:

  将第二个分区的大小缩小并在后面开辟一个ext2格式的新分区作为Linux分区;重写第一个分区,在Apple的OS引导代码之前加入Linux的loader(类似于lilo或者grub);最后在我们的第三个分区上建立linux操作系统。

  思路明晰后,我们就开始进行工作。

  为了在从第二分区开辟ext2新分区,我们需要将第二分区中所有的文件复制到其他地方,注意,Windows下必须display hidden files才能看到其中隐藏的文件夹。然后删除此第二分区,重新开辟第二个分区和第三个分区,第二分区格式化成fat32,将此前复制到其他地方的文件副本复制回来。第三分区则格式化成ext2。

  这一步骤的具体做法如下:
  将iPod插在USB,Ubuntu会自动将第二个分区挂载到/media/ipod,我们需要将其卸载以便继续工作:

  umount /dev/sdX2
  (iPod在Linux中,设备名称显示为:第一分区——/dev/sdX1,第二分区——/dev/sdX2,X为a、b、c……,X后面的数字未必相同,视你的具体情况)

  现在,我们先备份第一分区的数据:
  dd if=/dev/sdX1 of=ipod_boot_sector_backup bs=512 count=1

  如想恢复则执行如下命令:
  dd if=ipod_boot_sector_backup of=/dev/sd

  重新分区

  我们要用到Linux的分区工具fdisk来管理iPod的分区:
  /sbin/fdisk /dev/sdX

  fdisk工具的使用:
  p是查看分区列表,d是删除分区,n是建立分区(会寻问你新建的分区从哪里开始到哪里结束,我的第二分区是从第11个cylinder到第3000个cylinder,11是必须的,因为11=10+1。而3000可以根据你需要的第三分区大小调整,第三分区至少要100MB以上。),t是设置分区类型(b是FAT32,你不用设置第三分区类型,默认就是ext2),用a命令将第二分区设置为bootable。最后用w命令将这些设置写入分区表。(注意我们没有动第一分区——为了保持原先系统共存)

The number of cylinders for this disk is set to 3648.
There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 10 80293+ 0 Empty
/dev/sda2 11 3648 29222235 b W95 FAT32

Command (m for help):
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-3648, default 1): 11
Last cylinder or +size or +sizeM or +sizeK (11-3648, default 3648): 180

Command (m for help): p

Disk /dev/sda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 10 80293+ 0 Empty
/dev/sda3 11 180 1365525 83 Linux

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-3648, default 1): 181
Last cylinder or +size or +sizeM or +sizeK (181-3648, default 3648):
Using default value 3648

Command (m for help): p

Disk /dev/sda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 10 80293+ 0 Empty
/dev/sda2 181 3648 27856710 83 Linux
/dev/sda3 11 180 1365525 83 Linux

Partition table entries are not in disk order

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): b
Changed system type of partition 2 to b (W95 FAT32)

Command (m for help): p

Disk /dev/sda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 10 80293+ 0 Empty
/dev/sda2 181 3648 27856710 83 Linux
/dev/sda3 11 180 1365525 b W95 FAT32

Partition table entries are not in disk order

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款