Subject: is it possible to compile Alpine for 486？

From: 尤晓杰 <[email-masked]>
Date: Thu, 27 Nov 2025 15:33:57 +0800 (CST)

How can I modify -march parameter gracefully when I abuild command? Using abuild the default is -march=i586 -mtune=generic, is there a place to modify this parameter gracefully? and I have my best minimum kernel configure (best-mini.conf), how can I use my .conf file gracefully in abuild script?

6 	586/K5/5x86/6x86/6x86MX 	(-mtune=generic ; SIMD assembly modules enabled based on simple compile test and/or presence of CPU flag) 	1000 HZ 	Voluntary Kernel Preemption (Desktop) 	32 

does I need to compile i486-alpine-gcc crossing compile tools first?

---

From: "Sertonix" <[email-masked]>
Date: Thu, 27 Nov 2025 11:46:27 +0000

> does I need to compile i486-alpine-gcc crossing compile tools first?

I have never tried adding flags like -march without compiling a cross
compiler. There may be ways to make it work but I would not recommend it.

I would recommend to adapt _arch_configure in main/gcc/APKBUILD for your
target and then compile the cross compiler (with something like
scripts/bootstrap.sh <arch>).

You will likely encounter issues due to abuild missing (usable)
arch/triplet mappings for i486. The simplest (but a bit hacky) was is to
patch /usr/share/abuild/functions.sh. Ether by changing the "x86" arch to
be considered as i486 instead of i586:

--- a/functions.sh.in
+++ b/functions.sh.in
@@ -30 +30 @@ arch_to_triplet() {
-	x86)		echo "i586-alpine-linux-musl" ;;
+	x86)		echo "i486-alpine-linux-musl" ;;

Or by adding "i486" as new arch which may require changing more aports
to handle "i486" similar to "x86".

--- a/functions.sh.in
+++ b/functions.sh.in
@@ -29,2 +29,3 @@ arch_to_triplet() {
 	sh4)		echo "sh4-alpine-linux-musl" ;;
+	i486)		echo "i486-alpine-linux-musl" ;;
 	x86)		echo "i586-alpine-linux-musl" ;;
@@ -47,2 +48,3 @@ triplet_to_arch() {
 	armv7*-*-*-*eabihf)	echo "armv7" ;;
+	i486-*-*-*)		echo "i486" ;;
 	i[0-9]86-*-*-*)		echo "x86" ;;