Switching Images between i586 and x86_64

Beginning with AstLinux 1.2.5, two new board types were added: genx86_64 and genx86_64-serial. These boards are x86_64 builds using a 64-bit toolchain, initrd and Linux kernel.

In general, users will be advised to choose either a geni586[-serial] or genx86_64[-serial] install image and stick with that board type, but developers may want to take a shortcut and switch between i586 and x86_64.

It should be noted that the RUNNIX bootloader will support either i586 or x86_64 run image architectures. Additionally RUNNIX continues to be a 32-bit x86 image, so at first boot the system will be seen as 32-bit.

Note → With custom builds, the .config Buildroot config file determines what architecture is used. The build-system command ./scripts/build board_type allows you to qualify that .config options to a specific board type. In other words, building with ./scripts/build genx86_64-serial will not by itself generate a x86_64 image, you must first cp x86_64-configs/astlinux-ast11.config .config to make it happen.

Info → List of board types

Testing for x86_64 support

If this CLI command generates output, then your board should support x86_64: (“Long Mode” CPUID flag)

grep '^flags.* lm ' /proc/cpuinfo

If no output is generated then your board will not support x86_64.

Incompatibilities between i586 and x86_64

Somewhat surprisingly, almost everything works as expected when switching between i586 and x86_64, but there are a couple exceptions:

  • LDAP-AB using slapd, the /mnt/kd/ldap/data/data.mdb database is specific to 32 or 64 bits and needs to be rebuilt.
  • Asterisk FOP2 uses a binary blob for either 32 or 64 bit systems, so a new version must be installed. Your configuration should continue to work.
  • The initrd.img file that accompanies the run image is specific to 32 or 64 bits, usually not a problem. Do not revert to a different architecture and reboot.

Upgrade switch to x86_64 (64-bit) or i586 (32-bit)

Switching images requires using the CLI and SVN r7353 or later. You must see the trailing [32|64] with the following:

pbx ~ # upgrade-run-image 
Usage: upgrade-run-image check|upgrade|show|revert firmware_repository_url [32|64]

Example 1 - Currently using geni586 or geni586-serial image, switch to 64-bit:

upgrade-run-image check http://bla-bla.tld/beta-firmware-1.x 64
(if it looks good, then)
upgrade-run-image upgrade http://bla-bla.tld/beta-firmware-1.x 64

Example 2 - Currently using genx86_64 or genx86_64-serial image, switch to 32-bit:

upgrade-run-image check http://bla-bla.tld/beta-firmware-1.x 32
(if it looks good, then)
upgrade-run-image upgrade http://bla-bla.tld/beta-firmware-1.x 32

Tip → You may need to first do an upgrade-run-image revert (no reboot) to be able to upgrade if the repo versions match.

Rebuilding LDAP-AB (slapd) between i586 and x86_64

1) To be safe, first export the the database in LDIF format via the LDAP-AB tab. (should not be needed, just a backup)

2) Before you make an architecture switch…

service slapd stop
slapd -T cat > /mnt/kd/ldap/save.ldif
rm /mnt/kd/ldap/data/data.mdb

3) After you have made an architecture switch and rebooted…

service slapd stop
rm /mnt/kd/ldap/data/data.mdb
slapd -T add -l /mnt/kd/ldap/save.ldif
service slapd init

You could just use the LDAP-AB tab for the backup/restore, but using cat/add also restores the passwords.