dafero
Posts: 5
Joined: Tue Nov 11, 2014 8:14 am

archlinux ARM installation script

Fri Apr 29, 2016 9:26 pm

Hi all,

the other day I was reinstalling (again sigh...) archlinux ARM on my Pi2 and at the end I came up with a handy script to automate all the installation process.

I'm very happy with it and I think more people can benefit from it.
If you want to give it a go, you can find the code here: https://github.com/danifr/miscellaneous ... install.sh

Here is the log sample of all the steps done by the script.

Code: Select all

dafero@archenvy ~/g/miscellaneous> sudo sh alarm_install.sh 
[sudo] password for dafero: 
+***********************************************************+
*                                                           *
*  Welcome! This program will automate the installation of  *
*        ArchLinuxARM RP2 on your microSD card.             *
*                                                           *
+***********************************************************+
Please enter your sdcard device name [mmcblk0]: 
This program will FORMAT and INSTALL ArchLinuxARM on /dev/mmcblk0. Are you sure you want to continue?(y/n): y
[INFO] Unmounting SD card...
[INFO] Creating partitions on /dev/mmcblk0...

Welcome to fdisk (util-linux 2.28).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Created a new DOS disklabel with disk identifier 0x32557dab.

Command (m for help): Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-15523839, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): 
Created a new partition 1 of type 'Linux' and of size 100 MiB.

Command (m for help): Selected partition 1
Partition type (type L to list all types): Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (206848-15523839, default 206848): Last sector, +sectors or +size{K,M,G,T,P} (206848-15523839, default 15523839): 
Created a new partition 2 of type 'Linux' and of size 7.3 GiB.

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[INFO] Formating partitions...
mkfs.fat 3.0.28 (2015-05-16)
mke2fs 1.42.13 (17-May-2015)
/dev/mmcblk0p2 contains a ext4 file system
	last mounted on /run/media/dafero/4c04b58c-064b-4f17-8fa8-bbcbdab3c135 on Fri Apr 29 23:42:15 2016
Creating filesystem with 1914624 4k blocks and 479552 inodes
Filesystem UUID: 9edc9dad-41af-44e0-b2ef-34a1fb7d5e1c
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

[INFO] Creating temporary mount directories...
[INFO] Mounting...
[INFO] Downloading latest version of ArchLinuxARM from http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
--2016-04-29 23:45:12--  http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
Resolving os.archlinuxarm.org (os.archlinuxarm.org)... 50.116.36.110
Connecting to os.archlinuxarm.org (os.archlinuxarm.org)|50.116.36.110|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://nl2.mirror.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz [following]
--2016-04-29 23:45:12--  http://nl2.mirror.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
Resolving nl2.mirror.archlinuxarm.org (nl2.mirror.archlinuxarm.org)... 107.6.170.212
Connecting to nl2.mirror.archlinuxarm.org (nl2.mirror.archlinuxarm.org)|107.6.170.212|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 290319167 (277M) [application/octet-stream]
Saving to: ‘/tmp/ArchLinuxARM-rpi-2-latest.tar.gz’

/tmp/ArchLinuxARM-rpi-2-lat 100%[===========================================>] 276.87M  1.47MB/s    in 2m 59s  

2016-04-29 23:48:12 (1.55 MB/s) - ‘/tmp/ArchLinuxARM-rpi-2-latest.tar.gz’ saved [290319167/290319167]

[INFO] Extracting files into /tmp/raspberrypi/root...
[INFO] Syncing... (this might take a while)
[INFO] Copying boot into /tmp/raspberrypi/boot
[INFO] Unmounting...
[INFO] Everything looks good! Insert the sdcard in you RaspberryPi and have fun!
Feedback would be highly appreciated!!

Thanks a lot!
Daniel.

Koeshi
Posts: 228
Joined: Sun Mar 20, 2016 11:16 am

Re: archlinux ARM installation script

Sun May 01, 2016 11:26 am

I take it this is for those who already have Linux installed on their PCs, I may give it a go via VM if I have the time later.

Return to “Arch”