Template:Copying Alpine to Flash: Difference between revisions

From Alpine Linux
(Added note about /dev/sda1 missing)
m (Assuming the rest of the information is accurate, I added information on enabling a console for ttyS0 in inittab)
Line 56: Line 56:
  kernel /boot/grsec
  kernel /boot/grsec
  append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage console=tty1,38400 console=ttyS0,9600
  append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage console=tty1,38400 console=ttyS0,9600
Next, enable the serial console on ttyS0 by editing the inittab file:
# Open /media/sda1/etc/inittab for editing.
#* {{Cmd|vi /media/sda1/etc/inittab}}
# Find and uncomment the following line:
#: <pre>#ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100</pre>
#: So it looks like this:
#: <pre>ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100</pre>

Revision as of 17:53, 30 October 2010

Copy Alpine to a Flash Medium

  1. Insert the removable flash medium (CF or USB stick) into the computer.
  2. Determine the name your computer uses for your flash medium. The following step is one way to do this.
    • After inserting the flash medium, run the command:
    • dmesg

    • At the end of this command you should see the name of your flash medium, likely starting with "sd". (For example: "sda").
    • The remainder of this document will assume that your flash medium is called /dev/sda
Warning: Be very careful about this. You do not want to mistakenly wipe your hard drive if it's on /dev/sda


Format Flash Medium

fdisk /dev/sda

  • p Print list of partitions
  • d Delete all partitions (this may take a few steps)
  • n Create a new partition
  • p A primary partition
  • 1 Partition number 1
    • Use defaults for first and last cylinder (just press [Enter] twice).
  • t Change partition type
  • c Type: Win95 FAT32 (LBA)
  • a Make the partition bootable (set boot flag)
  • 1 Partition number 1
  • w Write your changes to the device

Install Syslinux

Note: If the following commands fail due to 'No such file or directory', you may have to remove and reinsert the CF card, or even reboot, to get /dev/sda1 to appear
  1. Install syslinux and dosfstools. If you have booted from an Alpine CD-ROM, use these commands:
    • apk add syslinux dosfstools

    • dd if=/usr/share/syslinux/mbr.bin of=/dev/sda

  2. Format the flash medium with a VFAT filesystem:
    • mkdosfs -F32 /dev/sda1

    • syslinux /dev/sda1

    • mkdir -p /media/sda1

    • mount -t vfat /dev/sda1 /media/sda1

  3. Mount the Alpine Linux CD-ROM, and copy the files to the flash medium
    • mount /media/cdrom

    • cd /media/cdrom

    • cp -a .alpine-release * /media/sda1/

Set up a Serial Console (Optional)

You can now edit syslinux.cfg to add a serial console to the flash medium.

  1. Open /media/sda1/syslinux.cfg for editing.
    • vi /media/sda1/syslinux.cfg

  2. Add the line `serial 0 9600` to the top of the file
  3. Add the text ` console=tty1,38400 console=ttyS0,9600` to the end of the "append" line.

The result should look like this:

serial 0 9600
timeout 20
prompt 1
default grsec
label grsec
	kernel /boot/grsec
	append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage console=tty1,38400 console=ttyS0,9600

Next, enable the serial console on ttyS0 by editing the inittab file:

  1. Open /media/sda1/etc/inittab for editing.
    • vi /media/sda1/etc/inittab

  2. Find and uncomment the following line:
    #ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100
    So it looks like this:
    ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100