Official Blog for OBE Messages
 

Older Post

Home

Newer Post
Monday, 6 August 2012
alpine linux installation using fdisk
i found a linux distro that use uclibc, busybox & linux kernel, it feels awesomely small, mini and suitable probably for embedded project.

i first discovered it through this link, http://winworldpc.com/library_m2.shtml, there are lots of amazing stuffs there :)

you can read more about alpine linux here.

Alpine Linux comes with some setup-* scripts to facilitate users, what i intend to write here is how to fdisk the hard disk, partition them, then install Alpine Linux into it manually.

1. download alpine linux iso file, the one i got is alpine-2.4.5-x86.iso

2. boot your machine, log in with root (no password)

3. key in setup-alpine

4. select keyboard layout, us

5. select variants, us

6. hostname, localhost

7. initialize eth0, enter to use dhcp (default)

8. password for root

9. hostname, localhost

10. timezone, UTC, you can change to other timezone, but it seems alpine script cannot accept the bios clock is local clock time

11. http proxy, none

12. finding mirrors, f to let alpine script find the best mirrors.

13. ssh server, openssh

14. ntp client, none

15. choose your hard disk, sda
Available disks are:
  sda	(19.3 GB ATA	VBOX HARDDISK	)
  sr0	(0.2 GB VBOX	CD-ROM		)
Which disk(s) would you like to use? (or '?' for help or 'none') [none] sda

16. key in sys because we want setup-alpine to extracts some files to ease our tasks later
How would you like to use it? ('sys', 'data' or '?' for help) [?] sys

17. please key in n, otherwise your whole hard disk will get auto partition by alpine-script.
WARNING: The following disk(s) will be erased:
  sda	(19.3 GB ATA	VBOX HARDDISK	)
WARNING: Erase the above disk(s) and continue? [y/N]: n
localhost:~#

18. fdisk /dev/sda

19. i want to set my partition to cylinder boundery, so below is the copy paste from putty screen
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2349, default 1):[enter here, no need to key in value]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2349, default 2349): 120

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (121-2349, default 121):[enter here, no need to key in value]
Using default value 121
Last cylinder or +size or +sizeM or +sizeK (121-2349, default 2349): 600

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (601-2349, default 601):[enter here, no need to key in value]
Using default value 601
Last cylinder or +size or +sizeM or +sizeK (601-2349, default 2349): 1500

Command (m for help): p

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1         120      963868+ 83 Linux
/dev/sda2             121         600     3855600  83 Linux
/dev/sda3             601        1500     7229250  83 Linux

20. then we set active boot on partition 1, change partition 2 to linux swap
Command (m for help): a
Partition number (1-4): 1

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

Command (m for help): p

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1   *           1         120      963868+ 83 Linux
/dev/sda2             121         600     3855600  82 Linux swap
/dev/sda3             601        1500     7229250  83 Linux

21. we use "w" to write our changes into partition table.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table

22. next we will need to format our /dev/sda1 & /dev/sda3, we can use the below command to perform these tasks.
localhost:~# mkfs.ext3 /dev/sda1
localhost:~# mkfs.ext3 /dev/sda3
localhost:~# mkswap /dev/sda2

23. we create /mnt/boot directory, then we will mount our partition to /mnt
localhost:~# mkdir /mnt/boot/
localhost:~# mount -t ext3 /dev/sda3 /mnt
localhost:~# mount -t ext3 /dev/sda1 /mnt/boot

24. install on our /mnt
localhost:~# mkdir setup-disk /mnt
You might need to fix the MBR to be able to boot

25. next is install the MBR to /dev/sda, using the below command
localhost:~# dd if=/usr/share/syslinux/mbr.bin of=/dev/sda
0+1 records in
0+1 records out

26. poweroff or reboot, then we can start apk packages into our mini alpine linux.

Labels: , , , ,

Post a Comment


Older Post

Home

Newer Post