help-guix
[Top][All Lists]
Advanced

[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

Hello,

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!

Cheers,
Alex


(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")

       (cross-glibc*
        (package
          (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"))
                    (sha256
                     (base32
                      "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
                    (patches
                     (search-patches "glibc-ldd-x86_64.patch"
                                     "glibc-versioned-locpath.patch"
                                     "glibc-vectorized-strcspn-guards.patch"
                                     "glibc-CVE-2015-5180.patch"
                                     "glibc-CVE-2016-3075.patch"
                                     "glibc-CVE-2016-3706.patch"
                                     "glibc-CVE-2016-4429.patch"
                                     "glibc-CVE-2017-1000366-pt1.patch"
                                     "glibc-CVE-2017-1000366-pt2.patch"
                                     "glibc-CVE-2017-1000366-pt3.patch"))
                    (modules '((guix build utils)))
                                  (snippet
                                   '(begin
                                      (substitute* "misc/regexp.c"
                                        (("char \\*loc1;")
                                         "char *loc1 __attribute__ 
((nocommon));")
                                        (("char \\*loc2;")
                                         "char *loc2 __attribute__ 
((nocommon));")
                                        (("char \\*locs;")
                                         "char *locs __attribute__ 
((nocommon));"))
                                      #t))))
          (arguments
           (substitute-keyword-arguments
               (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]