https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&user=Yuu&feedformat=atomAlpine Linux - User contributions [en]2024-03-29T09:14:25ZUser contributionsMediaWiki 1.40.0https://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=22247Upgrading Alpine2022-08-16T20:20:05Z<p>Yuu: Update alpine version example</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading from older versions ===<br />
<br />
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the subsequent version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.<br />
<br />
=== Upgrading to latest release ===<br />
<br />
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
=== Boot media === <br />
<br />
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.<br />
<br />
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update local package installations ===<br />
<br />
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
<br />
Backup the local configuration prior to upgrading.<br />
{{Cmd|lbu ci}}<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
After upgrading the packages, save the upgraded configuration changes.<br />
{{Cmd|lbu ci}}<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;<br />
ARCH&#61;$(cat /etc/apk/arch);}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";<br />
echo "arch : $ARCH"}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.16.2<br />
lbu media : mmcblk0p1<br />
arch : armhf}}<br />
<br />
4. Then you can run this script (WARNING : config.txt will be overwritten!) :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz</nowiki>;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256</nowiki>;<br />
sha256sum -c *.sha256;<br />
rm /media/$LBU_MEDIA/apks/$ARCH/*;<br />
rm /media/$LBU_MEDIA/cache/*;<br />
apk update && apk cache -v download;<br />
tar xzf alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-$ARCH.tar.gz alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
=== Update local package installations ===<br />
<br />
This is done just as at [[#Update local package installations]], above.<br />
<br />
== Updating a USB/CF diskless install without setup-bootable ==<br />
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.<br />
<br />
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:<br />
{{Cmd|apk update && apk upgrade -i -a --update-cache}}<br />
<br />
We can then use update-conf to check for changes to configurations from the new packages.<br />
{{Cmd|# check apk-new config changes<br />
update-conf -a -l<br />
update-conf -a<br />
}}<br />
<br />
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.<br />
<br />
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)<br />
<br />
{{Cmd|/etc/init.d/modloop stop<br />
mount /media/mmcblk0p1 -o remount,rw<br />
cd /media/mmcblk0p1<br />
}}<br />
<br />
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.<br />
<br />
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system. <br />
<br />
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256<br />
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz<br />
sha256sum -c *.sha256<br />
tar zxf *-aarch64.tar.gz && sync<br />
rm alpine-rpi-*<br />
}}<br />
<br />
Restore the original config.txt:<br />
{{Cmd|mv config.txt.bak config.txt}}<br />
<br />
Update the persistent storage using lbu:<br />
{{Cmd|lbu ci -d}}<br />
<br />
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:<br />
{{Cmd|mount /media/mmcblk0p1 -o remount,rw<br />
rm /media/mmcblk0p1/cache/*<br />
sync && apk update && apk cache -v download<br />
mount /media/mmcblk0p1 -o remount,ro<br />
}}<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=22246Upgrading Alpine2022-08-16T20:19:38Z<p>Yuu: Re-populate cache after deleting it</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading from older versions ===<br />
<br />
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the subsequent version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.<br />
<br />
=== Upgrading to latest release ===<br />
<br />
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
=== Boot media === <br />
<br />
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.<br />
<br />
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update local package installations ===<br />
<br />
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
<br />
Backup the local configuration prior to upgrading.<br />
{{Cmd|lbu ci}}<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
After upgrading the packages, save the upgraded configuration changes.<br />
{{Cmd|lbu ci}}<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;<br />
ARCH&#61;$(cat /etc/apk/arch);}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";<br />
echo "arch : $ARCH"}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.13.5<br />
lbu media : mmcblk0p1<br />
arch : armhf}}<br />
<br />
4. Then you can run this script (WARNING : config.txt will be overwritten!) :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz</nowiki>;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256</nowiki>;<br />
sha256sum -c *.sha256;<br />
rm /media/$LBU_MEDIA/apks/$ARCH/*;<br />
rm /media/$LBU_MEDIA/cache/*;<br />
apk update && apk cache -v download;<br />
tar xzf alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-$ARCH.tar.gz alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
=== Update local package installations ===<br />
<br />
This is done just as at [[#Update local package installations]], above.<br />
<br />
== Updating a USB/CF diskless install without setup-bootable ==<br />
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.<br />
<br />
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:<br />
{{Cmd|apk update && apk upgrade -i -a --update-cache}}<br />
<br />
We can then use update-conf to check for changes to configurations from the new packages.<br />
{{Cmd|# check apk-new config changes<br />
update-conf -a -l<br />
update-conf -a<br />
}}<br />
<br />
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.<br />
<br />
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)<br />
<br />
{{Cmd|/etc/init.d/modloop stop<br />
mount /media/mmcblk0p1 -o remount,rw<br />
cd /media/mmcblk0p1<br />
}}<br />
<br />
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.<br />
<br />
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system. <br />
<br />
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256<br />
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz<br />
sha256sum -c *.sha256<br />
tar zxf *-aarch64.tar.gz && sync<br />
rm alpine-rpi-*<br />
}}<br />
<br />
Restore the original config.txt:<br />
{{Cmd|mv config.txt.bak config.txt}}<br />
<br />
Update the persistent storage using lbu:<br />
{{Cmd|lbu ci -d}}<br />
<br />
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:<br />
{{Cmd|mount /media/mmcblk0p1 -o remount,rw<br />
rm /media/mmcblk0p1/cache/*<br />
sync && apk update && apk cache -v download<br />
mount /media/mmcblk0p1 -o remount,ro<br />
}}<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21723Odroid-C22022-04-11T20:48:54Z<p>Yuu: Aligments</p>
<hr />
<div>==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==U-Boot scripting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
<br />
==Booting==<br />
<br />
Connect your USB to TTL converter on your board : I noticed that you don't need to connect all wires, pin 1 don't seems to be is not mandatory at all.<br />
<pre><br />
_____UART____<br />
|Pin 4 - GND|<br />
|Pin 3 - RXD|<br />
|Pin 2 - TXD|<br />
|Pin 1 - VCC|<br />
\___________|<br />
</pre><br />
<br />
All details are available on the odroid wiki : https://wiki.odroid.com/accessory/development/usb_uart_kit</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21722Odroid-C22022-04-11T20:46:23Z<p>Yuu: Removed troubleshooting section</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==U-Boot scripting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
<br />
==Booting==<br />
<br />
Connect your USB to TTL converter on your board : I noticed that you don't need to connect all wires, pin 1 don't seems to be is not mandatory at all.<br />
<pre><br />
_____UART____<br />
|Pin 4 - GND|<br />
|Pin 3 - RXD|<br />
|Pin 2 - TXD|<br />
|Pin 1 - VCC|<br />
\___________|<br />
</pre><br />
<br />
All details are available on the odroid wiki : https://wiki.odroid.com/accessory/development/usb_uart_kit</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21721Odroid-C22022-04-11T20:45:55Z<p>Yuu: Booting part</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==U-Boot scripting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
<br />
==Booting==<br />
<br />
Connect your USB to TTL converter on your board : I noticed that you don't need to connect all wires, pin 1 don't seems to be is not mandatory at all.<br />
<pre><br />
_____UART____<br />
|Pin 4 - GND|<br />
|Pin 3 - RXD|<br />
|Pin 2 - TXD|<br />
|Pin 1 - VCC|<br />
\___________|<br />
</pre><br />
<br />
All details are available on the odroid wiki : https://wiki.odroid.com/accessory/development/usb_uart_kit<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21720Odroid-C22022-04-11T20:27:26Z<p>Yuu: Added booting part</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==U-Boot scripting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
<br />
==Booting==<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21719Odroid-C22022-04-11T20:26:26Z<p>Yuu: Change title</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==U-Boot scripting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21718Odroid-C22022-04-11T20:25:06Z<p>Yuu: Added spacing</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
<br />
==Booting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21717Odroid-C22022-04-11T20:22:53Z<p>Yuu: Mkimage precisions</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
==Booting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. The mkimage binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21716Odroid-C22022-04-11T20:18:35Z<p>Yuu: Added u-boot assembly</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make odroidc2_defconfig<br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
<br />
So, you need to get Amlogic u-boot's fork to assemble the u-boot binary :<br />
<pre><br />
cd ..<br />
git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 u-boot<br />
cd u-boot<br />
</pre><br />
<br />
Copy "u-boot.bin" from the previous git repository (source.denx.de) to the amlogic u-boot repository:<br />
<pre>cp ../u-boot-denx.de/u-boot.bin .</pre><br />
<br />
Then, generate u-boot using amlogic fip tools:<br />
<pre><br />
./fip/fip_create --bl30 ./fip/gxb/bl30.bin --bl301 ./fip/gxb/bl301.bin --bl31 ./fip/gxb/bl31.bin --bl33 u-boot.bin ./fip.bin<br />
./fip/fip_create --dump ./fip.bin<br />
cat ./fip/gxb/bl2.package ./fip.bin > ./boot_new.bin<br />
./fip/gxb/aml_encrypt_gxb --bootsig --input ./boot_new.bin --output ./u-boot.img<br />
dd if=./u-boot.img of=./u-boot.gxbb bs=512 skip=96<br />
</pre><br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
==Booting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. This binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21715Odroid-C22022-04-11T20:11:46Z<p>Yuu: Added booting part</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
==Booting==<br />
Create boot.cmd file to /dev/mmcblk0:<br />
<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
cat << EoF > boot.cmd<br />
#------------------------------------------------------------------------------------------------------<br />
#<br />
# HELP:<br />
# boot.cmd = source file for humans<br />
# boot.scr = destination file needed for the board<br />
# recompile-me with:<br />
# mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
#<br />
#------------------------------------------------------------------------------------------------------<br />
<br />
# init.<br />
setenv modloop "/boot/modloop"<br />
setenv console "tty1"<br />
setenv condev "console=ttyAML0,115200n8"<br />
setenv verbosity "7"<br />
setenv display_autodetect "true"<br />
<br />
# console arguments configuration<br />
setenv consoleargs "modules=loop,squashfs,sd-mod,usb-storage modloop=\${modloop} \${condev} console=\${console} panic=10"<br />
setenv bootargs "\${consoleargs} loglevel=\${verbosity}"<br />
<br />
# load files<br />
setenv devtype "mmc"<br />
setenv devnum "0:1"<br />
load \${devtype} \${devnum} \${kernel_addr_r} /boot/vmlinuz<br />
load \${devtype} \${devnum} \${ramdisk_addr_r} /boot/initramfs-lts<br />
load \${devtype} \${devnum} \${fdt_addr_r} /boot/dtbs/meson-gxbb-odroidc2.dtb<br />
<br />
# boot<br />
booti \$kernel_addr_r \$ramdisk_addr_r:3200000 \$fdt_addr_r<br />
EoF<br />
</pre><br />
<br />
Then, build this file for u-boot. This binary is available in the ./tools/ directory from the source.denx.de repository (see "Build u-boot from source" part).<br />
<pre><br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
</pre><br />
<br />
Please note that those two files must be placed in the /boot/ directory.<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21714Odroid-C22022-04-11T20:04:04Z<p>Yuu: Carriage return</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21713Odroid-C22022-04-11T20:00:07Z<p>Yuu: Added system part extraction</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
<br />
System part:<br />
<pre><br />
tar -C $DST -xzf alpine-uboot-3.15.4-aarch64.tar.gz ./.alpine-release ./alpine.apkovl.tar.gz ./apks ./boot/initramfs-lts 2>/dev/null<br />
</pre><br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21712Odroid-C22022-04-11T19:06:28Z<p>Yuu: Linux kernel : disable unnecessary DRM modules</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
We can also disable unrequired DRM modules. Hence you'll get les modules, vmlinux will be smaller and building kernel will be faster.<br />
Note that you can also disable more modules or functionalities, by removing all DRM drivers or disable sound if you like it. It'll be perfect for a headless machine.<br />
<pre><br />
sed -i -e 's/CONFIG_DRM_\(.*\)=.*/# CONFIG_DRM_\1 is not set/' .config<br />
sed -i -e 's/.*CONFIG_DRM_LIMA.*/CONFIG_DRM_LIMA=m/' .config<br />
sed -i -e 's/.*CONFIG_DRM_PANFROST.*/CONFIG_DRM_PANFROST=m/' .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
<br />
System part:<br />
<br />
''Work in progress''<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21691Odroid-C22022-04-05T19:54:02Z<p>Yuu: Fix pre tag</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
<br />
System part:<br />
<br />
''Work in progress''<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21690Odroid-C22022-04-05T19:52:59Z<p>Yuu: Device tree is required to boot</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pe><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
<br />
Copy dtb:<br />
<pre><br />
mkdir ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ${DST}/boot/dtbs<br />
cp arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dtb ${DST}/boot/dtbs<br />
</pre><br />
<br />
<br />
System part:<br />
<br />
''Work in progress''<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21689Odroid-C22022-04-05T19:49:24Z<p>Yuu: DVFS for s905</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
If you want to enable DVFS for the s905 amlogic cpu :<br />
<pre><br />
git apply --ignore-space-change --ignore-whitespace - << EOF<br />
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
index 201596247..027df3756 100644<br />
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts<br />
@@ -348,7 +348,8 @@ &saradc {<br />
};<br />
<br />
&scpi_clocks {<br />
- status = "disabled";<br />
+ /* Works only with new blobs that have limited DVFS table */<br />
+ status = "okay";<br />
};<br />
<br />
/* SD */<br />
EOF<br />
</pe><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
System part:<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21685Odroid-C22022-04-03T15:15:57Z<p>Yuu: Kernel assembly</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
Kernel part:<br />
<pre><br />
DST="/mnt/mmcblk0p1"<br />
gzip -c arch/arm64/boot/Image > ${DST}/vmlinuz<br />
cp .config ${DST}/config<br />
cp modloop ${DST}/modloop<br />
cp System.map ${DST}/System.map<br />
</pre><br />
System part:<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21684Odroid-C22022-04-03T14:52:53Z<p>Yuu: missing squashfs-tools package</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git squashfs-tools<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21683Odroid-C22022-04-03T14:35:39Z<p>Yuu: libssl-dev is required to build kernel from source</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libssl-dev libncurses-dev git<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21682Odroid-C22022-04-03T14:34:58Z<p>Yuu: fix kernel branch name, add ARCH and CROSS_COMPILE options</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libncurses-dev git<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.15.y linux-stable<br />
cd linux-stable<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=21679Upgrading Alpine2022-04-01T17:04:07Z<p>Yuu: Remove cached APK before extracting Alpine update</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading from older versions ===<br />
<br />
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the subsequent version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.<br />
<br />
=== Upgrading to latest release ===<br />
<br />
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
=== Boot media === <br />
<br />
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.<br />
<br />
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update local package installations ===<br />
<br />
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
<br />
Backup the local configuration prior to upgrading.<br />
{{Cmd|lbu ci}}<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
After upgrading the packages, save the upgraded configuration changes.<br />
{{Cmd|lbu ci}}<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;<br />
ARCH&#61;$(cat /etc/apk/arch);}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";<br />
echo "arch : $ARCH"}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.13.5<br />
lbu media : mmcblk0p1<br />
arch : armhf}}<br />
<br />
4. Then you can run this script (WARNING : config.txt will be overwritten!) :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz</nowiki>;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256</nowiki>;<br />
sha256sum -c *.sha256;<br />
rm /media/$LBU_MEDIA/apks/$ARCH/*;<br />
rm /media/$LBU_MEDIA/cache/*;<br />
tar xzf alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-$ARCH.tar.gz alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
6. Populate apk cache :<br />
{{apk update && apk cache -v download}}<br />
<br />
=== Update local package installations ===<br />
<br />
This is done just as at [[#Update local package installations]], above.<br />
<br />
== Updating a USB/CF diskless install without setup-bootable ==<br />
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.<br />
<br />
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:<br />
{{Cmd|apk update && apk upgrade -i -a --update-cache}}<br />
<br />
We can then use update-conf to check for changes to configurations from the new packages.<br />
{{Cmd|# check apk-new config changes<br />
update-conf -a -l<br />
update-conf -a<br />
}}<br />
<br />
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.<br />
<br />
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)<br />
<br />
{{Cmd|/etc/init.d/modloop stop<br />
mount /media/mmcblk0p1 -o remount,rw<br />
cd /media/mmcblk0p1<br />
}}<br />
<br />
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.<br />
<br />
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system. <br />
<br />
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256<br />
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz<br />
sha256sum -c *.sha256<br />
tar zxf *-aarch64.tar.gz && sync<br />
rm alpine-rpi-*<br />
}}<br />
<br />
Restore the original config.txt:<br />
{{Cmd|mv config.txt.bak config.txt}}<br />
<br />
Update the persistent storage using lbu:<br />
{{Cmd|lbu ci -d}}<br />
<br />
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:<br />
{{Cmd|mount /media/mmcblk0p1 -o remount,rw<br />
rm /media/mmcblk0p1/cache/*<br />
sync && apk update && apk cache -v download<br />
mount /media/mmcblk0p1 -o remount,ro<br />
}}<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=21678Upgrading Alpine2022-04-01T17:00:30Z<p>Yuu: /* Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) */</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading from older versions ===<br />
<br />
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the subsequent version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.<br />
<br />
=== Upgrading to latest release ===<br />
<br />
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
=== Boot media === <br />
<br />
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.<br />
<br />
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update local package installations ===<br />
<br />
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
<br />
Backup the local configuration prior to upgrading.<br />
{{Cmd|lbu ci}}<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
After upgrading the packages, save the upgraded configuration changes.<br />
{{Cmd|lbu ci}}<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;<br />
ARCH&#61;$(cat /etc/apk/arch);}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";<br />
echo "arch : $ARCH"}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.13.5<br />
lbu media : mmcblk0p1<br />
arch : armhf}}<br />
<br />
4. Then you can run this script (WARNING : config.txt will be overwritten!) :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz</nowiki>;<br />
wget <nowiki>https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256</nowiki>;<br />
sha256sum -c *.sha256;<br />
rm /media/$LBU_MEDIA/cache/*;<br />
tar xzf alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-$ARCH.tar.gz alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
6. Re-download cached apk :<br />
{{apk update && apk cache -v download}}<br />
<br />
=== Update local package installations ===<br />
<br />
This is done just as at [[#Update local package installations]], above.<br />
<br />
== Updating a USB/CF diskless install without setup-bootable ==<br />
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.<br />
<br />
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:<br />
{{Cmd|apk update && apk upgrade -i -a --update-cache}}<br />
<br />
We can then use update-conf to check for changes to configurations from the new packages.<br />
{{Cmd|# check apk-new config changes<br />
update-conf -a -l<br />
update-conf -a<br />
}}<br />
<br />
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.<br />
<br />
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)<br />
<br />
{{Cmd|/etc/init.d/modloop stop<br />
mount /media/mmcblk0p1 -o remount,rw<br />
cd /media/mmcblk0p1<br />
}}<br />
<br />
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.<br />
<br />
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system. <br />
<br />
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256<br />
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz<br />
sha256sum -c *.sha256<br />
tar zxf *-aarch64.tar.gz && sync<br />
rm alpine-rpi-*<br />
}}<br />
<br />
Restore the original config.txt:<br />
{{Cmd|mv config.txt.bak config.txt}}<br />
<br />
Update the persistent storage using lbu:<br />
{{Cmd|lbu ci -d}}<br />
<br />
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:<br />
{{Cmd|mount /media/mmcblk0p1 -o remount,rw<br />
rm /media/mmcblk0p1/cache/*<br />
sync && apk update && apk cache -v download<br />
mount /media/mmcblk0p1 -o remount,ro<br />
}}<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21668Odroid-C22022-03-22T19:45:59Z<p>Yuu: </p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies, for Debian (as example) :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libncurses-dev git<br />
</pre><br />
We need to set specific environment variables IF you are not using an arm64 machine. Usually, you should be running on a x64 architecture (Intel or AMD I guess), so you would like to cross-compile.<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
We need to build uboot from source as the u-boot provided does not autoboot without UART connected.<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
<br />
We used the specific deconfig for the Odroid-C2 but, as mentionned before : we want to autoboot with or without UART connection.<br />
You can still access the SPL prompt by pressing the 'Enter' key twice before the two seconds countdown.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
sed -i -e 's/.*CONFIG_AUTOBOOT_KEYED .*/CONFIG_AUTOBOOT_KEYED=y/' .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
<br />
Then, it's time to build :<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
Amlogic doesn’t provide sources for the firmware and for tools needed to create the bootloader image, so it is necessary to obtain them from the git tree published by the board vendor.<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.154.y linux-stable<br />
cd linux-stable<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig. This configuration is required for Alpine/Linux and not enabled by default.<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
The, build your kernel, associated modules and the [https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree DTB] (Device Tree Blob) from the source :<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Alpine_on_ARM&diff=21664Alpine on ARM2022-03-20T16:01:06Z<p>Yuu: Added link to internal guide to install Alpine on the Odroid-C2</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
{{Move|ARM SOCs}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
<br />
==Supported SoCs==<br />
<br />
Currently Alpine supports armv6/armhf arch on the following SoCs<br />
<br />
(This is taken from the DTBs which Alpine includes)<br />
<br />
{| class="wikitable collapsible"<br />
| am335x-base0033<br />
| am335x-bone<br />
| am335x-boneblack<br />
| am335x-evm<br />
| am335x-evmsk<br />
| am335x-nano<br />
| am335x-pepper<br />
| am3517-craneboard<br />
| am3517-evm<br />
| am3517_mt_ventoux<br />
| am437x-gp-evm<br />
|-<br />
| am437x-sk-evm<br />
| am43x-epos-evm<br />
| exynos4210-origen<br />
| exynos4210-smdkv310<br />
| exynos4210-trats<br />
| exynos4210-universal_c210<br />
| exynos4412-odroidu3<br />
| exynos4412-odroidx<br />
| exynos4412-odroidx2<br />
| exynos4412-origen<br />
| exynos4412-smdk4412<br />
| exynos4412-tiny4412<br />
|-<br />
| exynos4412-trats2<br />
| exynos5250-arndale<br />
| exynos5250-smdk5250<br />
| exynos5250-snow<br />
| exynos5260-xyref5260<br />
| exynos5410-smdk5410<br />
| exynos5420-arndale-octa<br />
| exynos5420-peach-pit<br />
| exynos5420-smdk5420<br />
| exynos5440-sd5v1<br />
| exynos5440-ssdk5440<br />
| exynos5800-peach-pi<br />
|-<br />
| imx1-ads<br />
| imx1-apf9328<br />
| imx25-eukrea-mbimxsd25-baseboard-cmo-qvga<br />
| imx25-eukrea-mbimxsd25-baseboard-dvi-svga<br />
| imx25-eukrea-mbimxsd25-baseboard-dvi-vga<br />
| imx25-eukrea-mbimxsd25-baseboard<br />
| imx25-karo-tx25<br />
| imx25-pdk<br />
| imx27-apf27<br />
| imx27-apf27dev<br />
| imx27-eukrea-mbimxsd27-baseboard<br />
| imx27-pdk<br />
|-<br />
| imx27-phytec-phycard-s-rdk<br />
| imx27-phytec-phycore-rdk<br />
| imx31-bug<br />
| imx35-eukrea-mbimxsd35-baseboard<br />
| imx35-pdk<br />
| imx50-evk<br />
| imx51-apf51<br />
| imx51-apf51dev<br />
| imx51-babbage<br />
| imx51-digi-connectcore-jsk<br />
| imx51-eukrea-mbimxsd51-baseboard<br />
| imx53-ard<br />
|-<br />
| imx53-m53evk<br />
| imx53-mba53<br />
| imx53-qsb<br />
| imx53-qsrb<br />
| imx53-smd<br />
| imx53-tx53-x03x<br />
| imx53-tx53-x13x<br />
| imx53-voipac-bsb<br />
| imx6dl-aristainetos_4<br />
| imx6dl-aristainetos_7<br />
| imx6dl-cubox-i<br />
| imx6dl-dfi-fs700-m60<br />
|-<br />
| imx6dl-gw51xx<br />
| imx6dl-gw52xx<br />
| imx6dl-gw53xx<br />
| imx6dl-gw54xx<br />
| imx6dl-gw552x<br />
| imx6dl-hummingboard<br />
| imx6dl-nitrogen6x<br />
| imx6dl-phytec-pbab01<br />
| imx6dl-rex-basic<br />
| imx6dl-riotboard<br />
| imx6dl-sabreauto<br />
| imx6dl-sabrelite<br />
|-<br />
| imx6dl-sabresd<br />
| imx6dl-tx6dl-comtft<br />
| imx6dl-tx6u-801x<br />
| imx6dl-tx6u-811x<br />
| imx6dl-wandboard-revb1<br />
| imx6dl-wandboard<br />
| imx6q-arm2<br />
| imx6q-cm-fx6<br />
| imx6q-cubox-i<br />
| imx6q-dfi-fs700-m60<br />
| imx6q-dmo-edmqmx6<br />
| imx6q-gk802<br />
|-<br />
| imx6q-gw51xx<br />
| imx6q-gw52xx<br />
| imx6q-gw53xx<br />
| imx6q-gw5400-a<br />
| imx6q-gw54xx<br />
| imx6q-gw552x<br />
| imx6q-hummingboard<br />
| imx6q-nitrogen6x<br />
| imx6q-phytec-pbab01<br />
| imx6q-rex-pro<br />
| imx6q-sabreauto<br />
| imx6q-sabrelite<br />
|-<br />
| imx6q-sabresd<br />
| imx6q-sbc6x<br />
| imx6q-tx6q-1010-comtft<br />
| imx6q-tx6q-1010<br />
| imx6q-tx6q-1020-comtft<br />
| imx6q-tx6q-1020<br />
| imx6q-tx6q-1110<br />
| imx6q-udoo<br />
| imx6q-wandboard-revb1<br />
| imx6q-wandboard<br />
| imx6sl-evk<br />
| imx6sx-sdb<br />
|-<br />
| armada-3720-espressobin-v7-emmc<br />
|-<br />
| omap3-beagle-xm-ab<br />
| omap3-beagle-xm<br />
| omap3-beagle<br />
| omap3-cm-t3517<br />
| omap3-cm-t3530<br />
| omap3-cm-t3730<br />
| omap3-devkit8000<br />
| omap3-evm-37xx<br />
| omap3-evm<br />
| omap3-gta04a3<br />
| omap3-gta04a4<br />
| omap3-gta04a5<br />
|-<br />
| omap3-ha-lcd<br />
| omap3-ha<br />
| omap3-igep0020<br />
| omap3-igep0030<br />
| omap3-ldp<br />
| omap3-lilly-dbb056<br />
| omap3-n9<br />
| omap3-n900<br />
| omap3-n950<br />
| omap3-overo-alto35<br />
| omap3-overo-chestnut43<br />
| omap3-overo-gallop43<br />
|-<br />
| omap3-overo-palo43<br />
| omap3-overo-storm-alto35<br />
| omap3-overo-storm-chestnut43<br />
| omap3-overo-storm-gallop43<br />
| omap3-overo-storm-palo43<br />
| omap3-overo-storm-summit<br />
| omap3-overo-storm-tobi<br />
| omap3-overo-summit<br />
| omap3-overo-tobi<br />
| omap3-sbc-t3517<br />
| omap3-sbc-t3530<br />
| omap3-sbc-t3730<br />
|-<br />
| omap3-thunder<br />
| omap3-zoom3<br />
| omap3430-sdp<br />
| omap4-duovero-parlor<br />
| omap4-panda-a4<br />
| omap4-panda-es<br />
| omap4-panda<br />
| omap4-sdp-es23plus<br />
| omap4-sdp<br />
| omap4-var-dvk-om44<br />
| omap4-var-stk-om44<br />
| omap5-cm-t54<br />
|-<br />
| omap5-sbc-t54<br />
| omap5-uevm<br />
| qcom-apq8064-cm-qs600<br />
| qcom-apq8064-ifc6410<br />
| qcom-apq8074-dragonboard<br />
| qcom-apq8084-ifc6540<br />
| qcom-apq8084-mtp<br />
| qcom-ipq8064-ap148<br />
| qcom-msm8660-surf<br />
| qcom-msm8960-cdp<br />
| qcom-msm8974-sony-xperia-honami<br />
| sun4i-a10-a1000<br />
|-<br />
| sun4i-a10-ba10-tvbox<br />
| sun4i-a10-cubieboard<br />
| sun4i-a10-hackberry<br />
| sun4i-a10-inet97fv2<br />
| sun4i-a10-mini-xplus<br />
| sun4i-a10-olinuxino-lime<br />
| sun4i-a10-pcduino<br />
| sun5i-a10s-olinuxino-micro<br />
| sun5i-a10s-r7-tv-dongle<br />
| sun5i-a13-hsg-h702<br />
| sun5i-a13-olinuxino-micro<br />
| sun5i-a13-olinuxino<br />
|-<br />
| sun6i-a31-app4-evb1<br />
| sun6i-a31-colombus<br />
| sun6i-a31-hummingbird<br />
| sun6i-a31-m9<br />
| sun7i-a20-cubieboard2<br />
| sun7i-a20-cubietruck<br />
| sun7i-a20-hummingbird<br />
| sun7i-a20-i12-tvbox<br />
| sun7i-a20-olinuxino-lime<br />
| sun7i-a20-olinuxino-micro<br />
| sun7i-a20-pcduino3<br />
| sun8i-a23-ippo-q8h-v5<br />
|-<br />
| vexpress-v2p-ca15-tc1<br />
| vexpress-v2p-ca15_a7<br />
| vexpress-v2p-ca5s<br />
| vexpress-v2p-ca9<br />
| vf610-colibri-eval-v3<br />
| vf610-cosmic<br />
| vf610-twr<br />
|}<br />
<br />
==Install Alpine on supported SoCs==<br />
<br />
=== Generic information ===<br />
<br />
(If anyone has one of the above devices and has successfully installed Alpine on it, please consider adding the missing info here.)<br />
<br />
==== Example with Wandboard ====<br />
<br />
===== Get latest Alpine image =====<br />
Download the last Generic ARM image on https://alpinelinux.org/downloads/<br />
Extract the archive somewhere.<br />
<br />
===== Prepare SD Card =====<br />
First install SPL and u-boot.img (this could change for other board):<br />
in root, write the SPL from Alpine extracted files :<br />
dd if=u-boot/wandboard/SPL of=/dev/sdX seek=1 bs=1k<br />
and the u-boot.img :<br />
dd if=u-boot/wandboard/u-boot.img of=/dev/sdX seek=69 bs=1k<br />
<br />
After create the partition on the sd-card with fdisk, then copy folders apks/ boot/ efi/ extlinux/ u-boot/ to the sd-card partition. (I'm not sure all folder as useful).<br />
<br />
After you can put the sd-card in the Wandboard and boot it with serial console connected.<br><br />
The board should boot on the sd-card. When the prompt ask a login, enter 'root'.<br />
Then launch 'setup-alpine' to configure the system.<br />
<br />
=== Specific guides ===<br />
<br />
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]<br />
* [[Raspberry_Pi]]<br />
* [[Raspberry_Pi_4_-_Persistent_system_acting_as_a_NAS_and_Time_Machine]]<br />
* [[Odroid-C2]]<br />
<br />
==Unupported SoCs==<br />
<br />
If you have an armv6/armv7 SoC which is not listed above but is supported by mainline uboot/kernel then it's still possible to install Alpine<br />
<br />
<br />
===Requiremnets===<br />
<br />
* Alpine's forked uboot to support tarballs (fabled?)<br />
* serial console<br />
* crosscompiler/toolchain if you can not compile natively<br />
<br />
<br />
===The embedded world===<br />
<br />
A lot of the SoCs have their own way of doing things, although they use uboot and Linux kernel but often they are heavily modified to suit easy flashing of "ROMs" or other unknown reasons, e.g. Rockchip's notion "partition" are neither DOS nor GPT partitions.<br />
We will discuss to install Alpine in a more standard way like x86 with either DOS or GPT partitions. You will most likely have to install/flash the mainline uboot, which can be non-destructive if you use external storage.<br />
<br />
<br />
====Storage====<br />
<br />
One can load uboot from the following block devices if it's supported.<br />
* NAND<br />
* eMMC<br />
* SD card<br />
* USB<br />
<br />
<br />
====Power on====<br />
<br />
Some SoCs need both SPL and uboot, you need to check uboot for your board. Most (if not all) boards boots from the internal storage first (either NAND or eMMC) you will have to check documentation of your board if you wish to boot the SPL/uboot from SD/USB.<br />
<br />
One can view SPL+uboot as BIOS and boot-loader on PC. Think that you could put the BIOS on an external storage :D<br />
<br />
Once you have loaded the "standard" uboot, things are more or less like on x86.<br />
<br />
<br />
====Partitioning====<br />
<br />
Either DOS or GPT patitions should work. Start of the first partition should be on block 2048 so there is space for SPL/uboot and marked bootable (with<br />
the MBR bootable flag, or GPT legacy_bios_bootable attribute).<br />
* SPL starts at block 64 (please consult the docs for your board)<br />
* uboot starts at block 256 (please consult the docs for your board)<br />
Just dd SPL and boot with the correct offset to the media you wish to boot<br />
<br />
====Booting Linux kernel====<br />
<br />
* uboot uses extlinux.conf file to locate the kernel/initramfs/... just like syslinx, you need to put that file on the partitions which is marked bootable in the /boot directory<br />
* there should be an extra line "FDTDIR" which points to the DTBs<br />
e.g.<br />
<pre><br />
label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl) 22 (Rawhide)<br />
kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl<br />
append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf<br />
fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl<br />
initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl.img<br />
</pre><br />
<br />
==Using QEMU==<br />
<br />
<pre><br />
qemu-system-arm -M vexpress-a9 -kernel zImage -initrd initramfs-grsec -dtb vexpress-v2p-ca9.dtb -hda hda.img -serial stdio<br />
</pre><br />
<br />
<br />
<br />
== References ==<br />
<br />
* [http://www.armadeus.org/wiki/index.php?title=Kernel-with-device-tree dtb (Device Tree Binary)]<br />
* [https://forum.odroid.com/viewtopic.php?t=30459 Odroid-C2] 2018 ''([https://archlinuxarm.org/platforms/armv8/amlogic/odroid-c2 ARMv8, AArch64]; [https://forum.odroid.com/viewtopic.php?f=138&t=32608 Alpine Linux custom build])''<br />
* [https://cusdeb.com/ CusDeb.com] - bootstrap SD-card images for single-board computers online; ''([https://github.com/tolstoyevsky/pieman Pieman])''<br />
* [https://kernelci.org/soc/ <s>Available</s> SoCs]<br />
<br />
[[Category:Hardware]]<br />
[[category:ARM]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21647Odroid-C22022-03-19T10:30:06Z<p>Yuu: </p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Required environement and toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies:<br />
Example on debian :<br />
<pre><br />
apt install bc bison flex make gcc gcc-aarch64-linux-gnu libncurses-dev git<br />
</pre><br />
Environement variables<br />
<pre><br />
export ARCH=arm64<br />
export CROSS_COMPILE=aarch64-linux-gnu<br />
</pre><br />
<br />
==Build u-boot from source==<br />
<pre><br />
git clone --depth 1 https://source.denx.de/u-boot/u-boot.git -b v2022.01 u-boot-denx.de<br />
cd u-boot-denx.de<br />
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-<br />
make mrproper && make odroid-c2_defconfig<br />
</pre><br />
Change boot options:<br />
TODO : remove lines<br />
< # CONFIG_AUTOBOOT_KEYED is not set<br />
< # CONFIG_AUTOBOOT_USE_MENUKEY is not set<br />
<br />
Patch default configuration:<br />
<pre><br />
sed -i -e 's/.*CONFIG_SD_BOOT.*/CONFIG_SD_BOOT=y/' .config<br />
echo "CONFIG_AUTOBOOT_KEYED=y" >> .config<br />
echo "CONFIG_AUTOBOOT_FLUSH_STDIN=y" >> .config<br />
echo "CONFIG_AUTOBOOT_PROMPT="Press quickly 'Enter' twice to stop autoboot: %d\n"" >> .config<br />
echo "# CONFIG_AUTOBOOT_ENCRYPTION is not set" >> .config<br />
echo "CONFIG_AUTOBOOT_DELAY_STR=""" >> .config<br />
echo "CONFIG_AUTOBOOT_STOP_STR="\xd\xd"" >> .config<br />
echo "CONFIG_AUTOBOOT_KEYED_CTRLC=y" >> .config<br />
</pre><br />
Build time:<br />
<pre><br />
time make -j$(nproc)<br />
</pre><br />
<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
<pre><br />
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-5.154.y linux-stable<br />
cd linux-stable<br />
make mrproper && make defconfig<br />
</pre><br />
We need to adapt the default arm64 generated by defconfig<br />
<pre><br />
sed -i -e 's/.*CONFIG_SQUASHFS_XZ.*/CONFIG_SQUASHFS_XZ=y/' .config<br />
sed -i -e 's/.*CONFIG_UEVENT_HELPER.*/CONFIG_UEVENT_HELPER=y/' .config<br />
sed -i -e 's/.*CONFIG_BLK_DEV_RAM.*/CONFIG_BLK_DEV_RAM=y/' .config<br />
echo CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\" >> .config<br />
echo CONFIG_BLK_DEV_RAM_COUNT=16 >> .config<br />
echo CONFIG_BLK_DEV_RAM_SIZE=4096 >> .config<br />
</pre><br />
<br />
Build the kernel:<br />
<pre><br />
time make -j$(nproc) Image dtbs modules<br />
</pre><br />
<br />
Create modloop:<br />
<pre><br />
rm -rf installed-modules && mkdir installed-modules<br />
INSTALL_MOD_PATH=installed-modules make modules_install<br />
find installed-modules -type l -delete<br />
rm -f modloop<br />
mksquashfs installed-modules/lib/ modloop -b 1048576 -comp xz -Xdict-size 100% -all-root<br />
rm -rf installed-modules<br />
</pre><br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21646Odroid-C22022-03-19T10:15:25Z<p>Yuu: </p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* [https://wiki.odroid.com/odroid-c2/odroid-c2 Odroid-C2]<br />
* Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)<br />
* micro-SD (or eMMC)<br />
* USB to TTL ([https://wiki.odroid.com/accessory/development/usb_uart_kit official] or [https://duckduckgo.com/?q=CP2102+ttl&t=h_&iax=images&ia=images CP2102 chipset] or an old rpi)<br />
<br />
<br />
==Toolchain==<br />
Using GNU/Linux is recommended and this guide and here are the required dependencies:<br />
Example on debian : apt install bc bison flex make gcc gcc-aarch64-linux-gnu libncurses-dev<br />
<br />
<br />
==Build u-boot from source==<br />
''Work in progress''<br />
<br />
<br />
==Build the latest LTS kernel from source==<br />
''Work in progress''<br />
<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21645Odroid-C22022-03-19T10:05:32Z<p>Yuu: </p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* Odroid-C2<br />
* Official PSU or just a micro-SD cable (the barrel plug is recommended)<br />
* micro-SD (or eMMC)<br />
* USB to TTL (official or CP2102 chipset or an old rpi)<br />
<br />
==Build u-boot from source==<br />
''Work in progress''<br />
<br />
==Build the latest LTS kernel from source==<br />
''Work in progress''<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Odroid-C2&diff=21644Odroid-C22022-03-19T10:05:13Z<p>Yuu: Alpine/Linux support for Odroid-C2</p>
<hr />
<div>{{TOC right}}<br />
{{Style}}<br />
<br />
(Parts of this page are WIP, still incomplete and some might be incorrect.)<br />
<br />
==Introduction==<br />
<br />
The Odroid-C2 single board computer is not very well supported by Alpine/Linux. However the "Generic ARM (aarch64)" build contains almost everything we need !<br />
<br />
What do we need ?<br />
* kernel : provided kernel by the Alpine team does not boot<br />
* u-boot : provided u-boot does not autoboot without serial<br />
* system files : everything is okay<br />
<br />
<br />
On the hardware side:<br />
* Odroid-C2<br />
* Official PSU or just a micro-SD cable (the barrel plug is recommended)<br />
* micro-SD (or eMMC)<br />
* USB to TTL (official or CP2102 chipset or an old rpi)<br />
<br />
==Build u-boot from source==<br />
''Work in progress''<br />
<br />
==Build the latest LTS kernel from source==<br />
''Work in progress''<br />
<br />
==Assembly==<br />
''Work in progress''<br />
<br />
==Booting==<br />
''Work in progress''<br />
<br />
==Troubleshooting==<br />
''Work in progress''</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=20124Upgrading Alpine2021-08-29T15:28:33Z<p>Yuu: /* Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) */</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading from older versions ===<br />
<br />
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the subsequent version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.<br />
<br />
=== Upgrading to latest release ===<br />
<br />
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.<br />
<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
<br />
<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
=== Boot media === <br />
<br />
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.<br />
<br />
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update local package installations ===<br />
<br />
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
<br />
Backup the local configuration prior to upgrading.<br />
{{Cmd|lbu ci}}<br />
<br />
{{:Include:Upgrading to latest release}}<br />
<br />
After upgrading the packages, save the upgraded configuration changes.<br />
{{Cmd|lbu ci}}<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;<br />
ARCH&#61;$(cat /etc/apk/arch);}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";<br />
echo "arch : $ARCH"}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.13.5<br />
lbu media : mmcblk0p1<br />
arch : armhf}}<br />
<br />
4. Then you can run this script (WARNING : config.txt will be overwritten!) :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/$ARCH/alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sha256sum -c *.sha256;<br />
tar xzf alpine-rpi-$VERSION_ID-$ARCH.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-$ARCH.tar.gz alpine-rpi-$VERSION_ID-$ARCH.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
=== Update local package installations ===<br />
<br />
This is done just as at [[#Update local package installations]], above.<br />
<br />
== Updating a USB/CF diskless install without setup-bootable ==<br />
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.<br />
<br />
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:<br />
{{Cmd|apk update && apk upgrade -i -a --update-cache}}<br />
<br />
We can then use update-conf to check for changes to configurations from the new packages.<br />
{{Cmd|# check apk-new config changes<br />
update-conf -a -l<br />
update-conf -a<br />
}}<br />
<br />
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.<br />
<br />
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)<br />
<br />
{{Cmd|/etc/init.d/modloop stop<br />
mount /media/mmcblk0p1 -o remount,rw<br />
cd /media/mmcblk0p1<br />
}}<br />
<br />
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.<br />
<br />
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system. <br />
<br />
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256<br />
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz<br />
sha256sum -c *.sha256<br />
tar zxf *-aarch64.tar.gz && sync<br />
rm alpine-rpi-*<br />
}}<br />
<br />
Restore the original config.txt:<br />
{{Cmd|mv config.txt.bak config.txt}}<br />
<br />
Update the persistent storage using lbu:<br />
{{Cmd|lbu ci -d}}<br />
<br />
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:<br />
{{Cmd|mount /media/mmcblk0p1 -o remount,rw<br />
rm /media/mmcblk0p1/cache/*<br />
sync && apk update && apk cache -v download<br />
mount /media/mmcblk0p1 -o remount,ro<br />
}}<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuuhttps://wiki.alpinelinux.org/w/index.php?title=Upgrading_Alpine&diff=19326Upgrading Alpine2021-05-13T10:38:59Z<p>Yuu: /* Upgrading Alpine Linux on other removable media (such as CF/USB) */</p>
<hr />
<div>This page covers upgrading to newer releases.<br />
<br />
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].<br />
<br />
<br />
<br />
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}<br />
<br />
<br />
== Upgrading an Alpine Linux Hard-disk installation ==<br />
<br />
=== Upgrading Alpine v2.x to v3.x ===<br />
<br />
{{Warning|Alpine Linux 3.x switched to a different libc implementation compared to previous versions. Because the new Musl libc is not ABI compatible with uClibc, there are additional steps required for an upgrade.}}<br />
<br />
==== Installing statically linked tools ====<br />
<br />
Statically linked version of apk-tools is needed, because the old musl version would stop working after a libc change (possibly in the middle of upgrade). Static version of busybox can be handy in case of the recovery from a failure.<br />
<br />
{{Cmd|apk add busybox-static apk-tools-static}}<br />
<br />
==== Changing repositories to v3.x ====<br />
<br />
To begin, you need to update your {{Path|/etc/apk/repositories}} file. Here are some shortcuts for doing so:<br />
:* Launch {{Cmd|setup-apkrepos}} Enter {{Key|e}} to edit {{Path|/etc/apk/repositories}}. Change the version number by hand.<br />
:* Or, edit the file in place. This is how you'd change <var>v2.7</var> to <var>v3.0</var>: {{Cmd|sed -i -e 's/<var>v2\.7</var>/<var>v3.0</var>/g' /etc/apk/repositories}}<br />
<br />
==== Upgrading system ====<br />
<br />
Use statically linked version of apk to update content of repository:<br />
<br />
{{Cmd|apk.static update}}<br />
<br />
Simulating upgrade is recommended in order to detect issues beforehand:<br />
<br />
{{Cmd|apk.static upgrade --no-self-upgrade --available --simulate}}<br />
<br />
With no problems encountered or after resolving them, start proper upgrade:<br />
<br />
{{Cmd|apk.static upgrade --no-self-upgrade --available}}<br />
<br />
=== Upgrading to latest release ===<br />
{{:Include:Upgrading to latest release}}<br />
<br />
=== Upgrading to Edge ===<br />
{{:Include:Upgrading to Edge}}<br />
<br />
=== Upgrading from older versions ===<br />
<br />
See [[Upgrading from older versions]].<br />
<br />
== Upgrading Alpine Linux on CD ==<br />
<br />
You may have an installation where the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information. In this case, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO. If you are booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box. <br />
<br />
=== Update remaining packages from Web repository ===<br />
<br />
If you are using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.<br />
{{:Include:Using_Internet_Repositories_for_apk-tools}}<br />
<br />
If you're upgrading from a version of Alpine before 2.3.0_rc1, ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:<br />
{{Cmd|apk add --upgrade apk-tools}}<br />
<br />
Next, upgrade all your packages:<br />
<br />
{{Cmd|apk upgrade --available<br />
sync}}<br />
<br />
The <code>--available</code> switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc require doing this.<br />
<br />
After upgrading packages, save any configuration changes (you should have backed up your earlier configuration prior to upgrading).<br />
{{Cmd|lbu ci}}<br />
<br />
<br />
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==<br />
<br />
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:<br />
{{Cmd|apk upgrade --update-cache --available}}<br />
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)<br />
<br />
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.<br />
<br />
{{:Include:Upgrading_Alpine_environmentvars}}<br />
<br />
=== Upgrade Operating System ===<br />
<br />
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.<br />
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}<br />
<br />
==== Download and verify new release ====<br />
<br />
Make sure the media that holds your Alpine system is mounted readwrite.<br />
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}<br />
<br />
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.<br />
<br />
==== For older versions of Alpine ====<br />
Start downloading a new '.iso' and a '.sha1' file <br />
{{Cmd|cd /media/$LBU_MEDIA<br />
wget -c {{#latestalp:alpine|url}}<br />
wget {{#latestalp:alpine|url}}.sha1}}<br />
<br />
Check integrity of the downloaded files ''(it might take some time)'':<br />
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}<br />
''The output of the above command should say 'OK'.<BR>''<br />
''If says 'FAILED', delete the iso file and download it again.''<br />
<br />
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}<br />
<br />
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.<br />
<br />
=== Save changes ===<br />
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).<br />
{{Cmd|lbu ci}}<br />
<br />
=== Load new kernel ===<br />
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):<br />
{{Cmd|sync<br />
reboot}}<br />
<br />
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}<br />
<br />
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===<br />
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.<br />
<br />
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :<br />
{{Cmd|apk update; apk version -l '<';<br />
apk upgrade;<br />
lbu ci;}}<br />
<br />
So now all your packages are upgraded, you can upgrade your kernel.<br />
<br />
1. We need to get some variables :<br />
{{Cmd|. /etc/os-release;<br />
. /etc/lbu/lbu.conf;}}<br />
<br />
2. You '''must''' verify if they are correctly set, using this :<br />
{{Cmd|echo "alpine version : $VERSION_ID";<br />
echo "lbu media : $LBU_MEDIA";}}<br />
<br />
3. And it will output something like this (if not, do not continue this process) :<br />
{{Cmd|alpine version : 3.13.5<br />
lbu media : mmcblk0p1}}<br />
<br />
4. Then you can run this script :<br />
{{Cmd|cd /media/$LBU_MEDIA;<br />
mount -oremount,rw /media/$LBU_MEDIA;<br />
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz;<br />
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256;<br />
sha256sum -c *.sha256;<br />
tar xzf alpine-rpi-$VERSION_ID-armhf.tar.gz;<br />
rm alpine-rpi-$VERSION_ID-armhf.tar.gz alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256;<br />
sync;<br />
reboot;}}<br />
<br />
5. Test-it !<br />
{{Cmd|uname -a}}<br />
<br />
=== Update remaining packages from Web repository ===<br />
If you are using [[How_to_enable_APK_caching|APK caching]] you should follow the instructions to [[#Update_remaining_packages_from_Web_repository|Update remaining packages from Web repository]], above.<br />
<br />
<br />
[[Category:Installation]]<br />
[[Category:Package Manager]]</div>Yuu