[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to run guix on replicant / android with linux 3.0?

From: Alex Vong
Subject: How to run guix on replicant / android with linux 3.0?
Date: Sun, 17 Feb 2019 05:51:08 +0800


I've a phone with replicant installed. It runs linux 3.0.x which is too
old for guix glibc (which requires linux 3.2.x). Using the hint at the
bottom of 'cross-base.scm', I successfully build cross-gcc with
cross-glibc 2.23 (configured with '--enable-kernel=3.0.0') for
armhf. Using them, I can cross-compile a statically linked hello world.

Is there an easy way to make relocatable guix pack with glibc 2.23
(configured with '--enable-kernel=3.0.0') for armhf? (My phone doesn't
connect to the internet, so I can't use 'guix pull' and 'guix
manifest'.) Right now, I have to manually set the '-B', '-I', '-L' and
'-sysroot' paths to cross-gcc to make it build hello world (which is
wrong and very tedious).

The snippet is copied below for reference, but please don't use it, it's
only a proof-of-concept. Thanks for help!


(use-modules (guix packages)
             (guix utils)
             (gnu packages)
             (gnu packages base)
             (gnu packages cross-base))

(let* ((triplet "arm-linux-gnueabihf")

       (cross-linux (@@ (gnu packages cross-base) cross-kernel-headers))
       (cross-linux* (cross-linux triplet))

       (cross-binutils* (cross-binutils triplet))
       (cross-glibc (cross-libc triplet))
       (cross-glibc-version "2.23")

          (inherit cross-glibc)
          (version cross-glibc-version)
          (source (origin
                    (inherit (package-source glibc))
                    (uri (string-append "mirror://gnu/glibc/glibc-"
                                        cross-glibc-version ".tar.xz"))
                     (search-patches "glibc-ldd-x86_64.patch"
                    (modules '((guix build utils)))
                                      (substitute* "misc/regexp.c"
                                        (("char \\*loc1;")
                                         "char *loc1 __attribute__ 
                                        (("char \\*loc2;")
                                         "char *loc2 __attribute__ 
                                        (("char \\*locs;")
                                         "char *locs __attribute__ 
               (package-arguments cross-glibc)
             ((#:configure-flags flags)
              `(append ,flags (list "--enable-kernel=3.0.0")))))))

       (cross-gcc* (cross-gcc triplet
                              #:xbinutils (cross-binutils triplet)
                              #:libc cross-glibc*)))

  (list cross-linux* cross-binutils* cross-glibc* cross-gcc*))

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]