Difference between revisions of "Funtoo Linux Installation on ARM"

From Funtoo
Jump to navigation Jump to search
(fix "clearing the root password" section)
m (/mnt/funtoo!!!!)
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages />
<languages />
<translate>
<translate>
Funtoo now provides stage3 images ([https://build.funtoo.org/1.3-release-std/arm-32bit/ 32-bit] and [https://build.funtoo.org/1.3-release-std/arm-64bit/ 64-bit]) for Release 1.3 on arm platforms. At this time armv5te, armv6j_hardfp and armv7a_hardfp stages available. If you would like us to support other processors (see the list below), please fill a bug report on [http://bugs.funtoo.org].
Funtoo provides stage3 images for arm platforms. [[Subarches]] At this time armv5te, armv6j_hardfp and armv7a_hardfp stages available. If you would like us to support other processors (see the list below), please fill a bug report on [http://bugs.funtoo.org].


{{note|An alternative approach to installation of Funtoo Linux on Raspberry Pi devices is available here: [[Funtoo_Linux_Installation_on_RPI]]
==[[Funtoo_Linux_Installation_on_RPI]]==


It should at least be read to fill in some gaps that this dated document does not go into--just remember it is specific to Raspberry Pi boxen. }}
Should at least be read to fill in some gaps that this dated document does not go into--just remember it is specific to Raspberry Pi.


== List of ARM processor "flavors" ==
== List of ARM processor "flavors" ==
Line 14: Line 14:
* armv7a-unknown-linux-gnueabi (OMAP3-based devices(Beagleboard, IGEPv2, Devkit8000, AlwaysInnovating Touchbook, [[Nokia N900]]), OMAP4-based devices([[Pandaboard]]), Freescale i.MX515-based devices([[Efika MX]], Babbage Board, Lange Board…) Marvell Dove/Armada, Nvidia Tegra2-based devices(Toshiba AC100, Toshiba Folio), ST-Ericsson NOVA A9500-based devices(Snowball), Exynos 4412 ([[Odroid-X]], Odroid-Q, [[ODROID U2]]) and other devices using an ARMv7-A processor. Uses the new ARM EABI and generic(not NEON) hardware floating point by default
* armv7a-unknown-linux-gnueabi (OMAP3-based devices(Beagleboard, IGEPv2, Devkit8000, AlwaysInnovating Touchbook, [[Nokia N900]]), OMAP4-based devices([[Pandaboard]]), Freescale i.MX515-based devices([[Efika MX]], Babbage Board, Lange Board…) Marvell Dove/Armada, Nvidia Tegra2-based devices(Toshiba AC100, Toshiba Folio), ST-Ericsson NOVA A9500-based devices(Snowball), Exynos 4412 ([[Odroid-X]], Odroid-Q, [[ODROID U2]]) and other devices using an ARMv7-A processor. Uses the new ARM EABI and generic(not NEON) hardware floating point by default
* armv7a-hardfloat-linux-gnueabi ([[Raspberry Pi 2]], Beagleboard-X15. The same as armv7a-unknown-linux-gnueabi, but this one uses hardfloat instead of softfp. Read more about it here: http://wiki.debian.org/ArmHardFloatPort)
* armv7a-hardfloat-linux-gnueabi ([[Raspberry Pi 2]], Beagleboard-X15. The same as armv7a-unknown-linux-gnueabi, but this one uses hardfloat instead of softfp. Read more about it here: http://wiki.debian.org/ArmHardFloatPort)
* Raspberry Pi 4 [[Raspberry_Pi_4]]


== Default installation of Funtoo on your platform/board ==
== Default installation of Funtoo on your platform/board ==
Line 48: Line 50:
Mount the partition that will hold your rootfs of the SD card and extract the stage3 you have downloaded.
Mount the partition that will hold your rootfs of the SD card and extract the stage3 you have downloaded.


<console>
{{console|body=
# ##i##mkdir /mnt/SD_root
###i## mkdir /mnt/funtoo
# ##i##mount /dev/sdcard-device-px /mnt/SD_root
###i## mount /dev/sdcard-device-px /mnt/funtoo
</console>
}}


Extract the stage3 (it may take a while).
Extract the stage3 (it may take a while).
<console>
{{console|body=
# ##i##tar xapf stage3-armv7a_hardfp-xxxx.tar.xz -C /mnt/SD_root
###i## tar xapf stage3-armv7a_hardfp-xxxx.tar.xz -C /mnt/funtoo
</console>
}}
 
==== Extracting a portage snapshot ====
 
[''This step is deprecated''--git and ego sync will later obtain these files.]
Now, download the portage snapshot from [http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/], and extract it to your partition.
 
<console>
# ##i##tar xapf portage-latest.tar.xz -C /mnt/SD_root/usr
</console>


==== Setup fstab ====
==== Setup fstab ====
Edit the <tt>/mnt/SD_root/etc/fstab</tt> file to look like this:
Edit the <tt>/mnt/funtoo/etc/fstab</tt> file to look like this:


<pre>
<pre>
Line 107: Line 100:
Then, edit the shadow file and use the output of the last command to replace "YOUR_PASSWORD_MD5".
Then, edit the shadow file and use the output of the last command to replace "YOUR_PASSWORD_MD5".


<console>
{{console|body=
# ##i##nano -w /mnt/SD_root/etc/shadow
###i## nano -w /mnt/funtoo/etc/shadow
</console>
}}


<pre>
<pre>
Line 126: Line 119:
First, add swclock to the boot runlevel.
First, add swclock to the boot runlevel.
<console>
<console>
# ##i##ln -sf /etc/init.d/swclock /mnt/SD_root/etc/runlevels/boot
# ##i##ln -sf /etc/init.d/swclock /mnt/funtoo/etc/runlevels/boot
</console>
</console>


Then, remove hwclock from the startup because it sets the date from the RTC, which is 2000-01-01 upon startup and overrides swclock's date.
Then, remove hwclock from the startup because it sets the date from the RTC, which is 2000-01-01 upon startup and overrides swclock's date.
<console>
{{console|body=
# ##i##rm /mnt/SD_root/etc/runlevels/boot/hwclock
# ##i##rm /mnt/funtoo/etc/runlevels/boot/hwclock
</console>
}}


swclock uses the <tt>/lib/rc/cache/shutdowntime</tt> modification time to set the date, therefore we update it to have the current date and time.
swclock uses the <tt>/lib/rc/cache/shutdowntime</tt> modification time to set the date, therefore we update it to have the current date and time.
<console>
{{console|body=
# ##i##touch /mnt/SD_root/lib/rc/cache/shutdowntime
###i## touch /mnt/funtoo/lib/rc/cache/shutdowntime
</console>
}}


Although this doesn't fix the issue, at least helps to set a sane date and time.
Although this doesn't fix the issue, at least helps to set a sane date and time.
Line 146: Line 139:
Adding sshd to the default runlevel will enable access to the device using ssh (if network has been configured).
Adding sshd to the default runlevel will enable access to the device using ssh (if network has been configured).


<console>
{{console|body=
# ##i##ln -sf /etc/init.d/sshd /mnt/SD_root/etc/runlevels/default
###i## ln -sf /etc/init.d/sshd /mnt/funtoo/etc/runlevels/default
</console>
}}


If no network has been configured yet, it might be a good idea to add dhcpcd in the default runlevel as well.
If no network has been configured yet, it might be a good idea to add dhcpcd in the default runlevel as well.


<console>
<console>
# ##i##ln -sf /etc/init.d/dhcpcd /mnt/SD_root/etc/runlevels/default
# ##i##ln -sf /etc/init.d/dhcpcd /mnt/funtoo/etc/runlevels/default
</console>
</console>


Line 159: Line 152:
By default the ttyS0 port is configured at 9600 bps. However, almost all of the ARM devices run the serial port at 115200 bps. Also, the port device names differ (ttyO2 for Pandaboard, ttySAC1 for Odroid-X ...). So edit your /etc/inittab file:
By default the ttyS0 port is configured at 9600 bps. However, almost all of the ARM devices run the serial port at 115200 bps. Also, the port device names differ (ttyO2 for Pandaboard, ttySAC1 for Odroid-X ...). So edit your /etc/inittab file:


<console>
{{console|body=
# ##i##nano -w /mnt/SD_root/etc/inittab
###i## nano -w /mnt/funtoo/etc/inittab
</console>
}}


Example for Pandaboard:
Example for Pandaboard:
Line 171: Line 164:
Let's unmount the SD card.
Let's unmount the SD card.
<console>
<console>
# ##i##umount /mnt/SD_root
# ##i##umount /mnt/funtoo
</console>
</console>



Revision as of 04:42, November 9, 2020

Funtoo provides stage3 images for arm platforms. Subarches At this time armv5te, armv6j_hardfp and armv7a_hardfp stages available. If you would like us to support other processors (see the list below), please fill a bug report on [1].

Funtoo_Linux_Installation_on_RPI

Should at least be read to fill in some gaps that this dated document does not go into--just remember it is specific to Raspberry Pi.

List of ARM processor "flavors"

  • armv4l-unknown-linux-gnu (Rebel NetWinder, HP Armada and other devices having an ARMv4 processor, which is only capable of running the old ABI. Nevertheless it should work on newer CPUs)
  • armv4tl-softfloat-linux-gnueabi (OpenMoko FreeRunner and other devices using an ARMv4T processor. Uses the new ARM EABI and software floating point by default)
  • armv5tel-softfloat-linux-gnueabi (almost all ARM NAS, devices based on the Marvell Orion and Marvell Kirkwood, Marvell Sheevaplug, Marvell OpenRD, Guruplug, Dreamplug, QNAP TS109/TS209/TS409/TS119/TS219/TS419, Buffalo Linkstation/Kurobox PRO, HP mv2120, HP iPAQ, Linksys NSLU2 and other devices using an ARMv5TE processor. Uses the new ARM EABI and software floating point by default)
  • armv6j-unknown-linux-gnueabi (Raspberry Pi, Nokia N800/N810, Smart Q7, OMAP2-based devices and other multimedia devices using an ARMv6 CPU and VFP. Uses the new ARM EABI and hardware floating point by default)
  • armv7a-unknown-linux-gnueabi (OMAP3-based devices(Beagleboard, IGEPv2, Devkit8000, AlwaysInnovating Touchbook, Nokia N900), OMAP4-based devices(Pandaboard), Freescale i.MX515-based devices(Efika MX, Babbage Board, Lange Board…) Marvell Dove/Armada, Nvidia Tegra2-based devices(Toshiba AC100, Toshiba Folio), ST-Ericsson NOVA A9500-based devices(Snowball), Exynos 4412 (Odroid-X, Odroid-Q, ODROID U2) and other devices using an ARMv7-A processor. Uses the new ARM EABI and generic(not NEON) hardware floating point by default
  • armv7a-hardfloat-linux-gnueabi (Raspberry Pi 2, Beagleboard-X15. The same as armv7a-unknown-linux-gnueabi, but this one uses hardfloat instead of softfp. Read more about it here: http://wiki.debian.org/ArmHardFloatPort)

Default installation of Funtoo on your platform/board

This document is not a complete installation tutorial. Basic information about Funtoo Linux installation can be found on Funtoo Linux Installation. The goal of this document is to provide general information about installing Funtoo Linux on an ARM device, and highlight differences with a x86 installation.

The following notes are non-board specific. Other instructions can be found in the specific articles for the above mentioned devices.

Overview

Most of the ARM boards come with a SD card slot, so you will need an empty SD card (4GB is enough to get you started), in most cases the boards are also equipped with debug port which can be used with USB-to-serial cables, if you have one, you can use it to login to the machine without the need of connecting keyboards or displays. You will need a network connection to be able to download stages, kernel and update your portage tree.

Kernel and bootloader setup

Before you start you will need a kernel and a bootloader for your device. Some of the devices look for bootloader (in most cases U-Boot) on the SD along with the kernel.

More information about the kernel and bootloader can be found on pages specific for your device.

Installing Funtoo (overview)

The installation on these devices differs from the normal installation procedure of booting an installation environment and chrooting from there to your new root, and can be little bit easier, but in some cases tricky.

Overview of the installation:

  • Extract stage3 to the 2nd partition of the SD card
  • Extract portage snapshot
  • Setup fstab
  • Setup root password
  • Configure hostname and networking (optional, but recommended)
  • Enable SSH access (optional, but recommended)
  • Enable serial console access (optional, but recommended)
  • Correct RTC "bug" with swclock

Installing the Stage 3 tarball

Links to ARM stage3 tarballs are in the first paragraph of this document. Use the subarchitecture that suits best your device.

Mount the partition that will hold your rootfs of the SD card and extract the stage3 you have downloaded.

root # mkdir /mnt/funtoo
root # mount /dev/sdcard-device-px /mnt/funtoo

Extract the stage3 (it may take a while).

root # tar xapf stage3-armv7a_hardfp-xxxx.tar.xz -C /mnt/funtoo

Setup fstab

Edit the /mnt/funtoo/etc/fstab file to look like this:

 /dev/mmcblk0p1		/boot		vfat		noauto,noatime	1 2
 /dev/mmcblk0p2		/		ext4		noatime		0 1

Adjust the partition devices and types to suit your needs.

Setting the default root password

   Warning

Don't skip this step. This part differs from the standard installation procedure, as the root password must be set outside of a chroot environment. Skipping this step will result in an impossibility to login.

Normally, for setting the password, one has to be able to run passwd. However that's not possible in this case since an x86 system can't run ARM binaries. Therefore, it is needed to modify the files that contains the passwords (/etc/passwd and /etc/shadow) to set a default root password.

Clearing the root password

This will allow to login with a blank password for the root user.

root # sed -i -e 's/root:x:0/root::0/' etc/passwd
root # echo "PermitRootLogin yes
PermitEmptyPasswords yes" >> etc/ssh/sshd_config
   Warning

After initial login, remember to:

  1. sed -i -e 's/root::0/root:x:0/' /etc/passwd
  2. change the root password using the passwd command
  3. remove last 2 lines we added from /etc/ssh/sshd_config
Choosing a root password (alternative)

First, generate a password. The output of this command will be used to modify the shadow file.

root # openssl passwd -1
or
root # python -c "import crypt, getpass, pwd; print crypt.crypt('password', '\$6\$SALTsalt\$')"

Then, edit the shadow file and use the output of the last command to replace "YOUR_PASSWORD_MD5".

root # nano -w /mnt/funtoo/etc/shadow
 root:YOUR_PASSWORD_MD5:14698:0:::::

Setup hostname and networking

Please read the Funtoo Linux Networking to configure your network.


Using swclock

One of the problems some of the devices have, is that they don't have a battery to save the clock time. To mitigate this, on Funtoo we have an option in our init system called swclock which sets the date of the system upon boot from a last modified date of a file.


First, add swclock to the boot runlevel.

root # ln -sf /etc/init.d/swclock /mnt/funtoo/etc/runlevels/boot

Then, remove hwclock from the startup because it sets the date from the RTC, which is 2000-01-01 upon startup and overrides swclock's date.

root # rm /mnt/funtoo/etc/runlevels/boot/hwclock

swclock uses the /lib/rc/cache/shutdowntime modification time to set the date, therefore we update it to have the current date and time.

root # touch /mnt/funtoo/lib/rc/cache/shutdowntime

Although this doesn't fix the issue, at least helps to set a sane date and time. Note: Consider using NTP, documented on the next chapter


Enabling SSH access (optional)

Adding sshd to the default runlevel will enable access to the device using ssh (if network has been configured).

root # ln -sf /etc/init.d/sshd /mnt/funtoo/etc/runlevels/default

If no network has been configured yet, it might be a good idea to add dhcpcd in the default runlevel as well.

root # ln -sf /etc/init.d/dhcpcd /mnt/funtoo/etc/runlevels/default

Enabling serial console access (optional)

By default the ttyS0 port is configured at 9600 bps. However, almost all of the ARM devices run the serial port at 115200 bps. Also, the port device names differ (ttyO2 for Pandaboard, ttySAC1 for Odroid-X ...). So edit your /etc/inittab file:

root # nano -w /mnt/funtoo/etc/inittab

Example for Pandaboard:

s0:12345:respawn:/sbin/agetty 115200 ttyO2 vt100

Finishing the installation and booting up the new system

Let's unmount the SD card.

root # umount /mnt/funtoo

Troubleshooting

With the armv5te at least, these instructions work great. However, when it is time to update sys-devel/gcc this underpowered wimp has trouble, mainly due to limited memory I think. Cross-compiling toolchains made by crossdev work well within limits, it won't do gcc. However I have found a trick that works well and solves this, thanks to the timely posting of new stage3's by Funtoo.
Simply make a chroot using qemu-user files as described here: http://wiki.gentoo.org/wiki/Cross_Container_Support_Project Enter the chroot and tweak your /etc/portage/make.conf to point to the directory you wish to save packages to (PACKAGEDIR) and any other necessary tweaks in there.
Since this latest stage3 will have the latest gcc installed in it, simply enter:

root # quickpkg sys-devel/gcc

It will build the binary package, which then installs on my Dockstar quickly & easily in comparison to compiling 48 hours and then failing.
As an added bonus you now have a nifty arm chroot you may find handy for other tasks.