Hello,
I try to build the Image for the pinePhone.
Steps 1 did to build:
-
install nixos on a x86_64 system
-
update nixos
-
create crossShell.nix
with import <nixpkgs> {
crossSystem = {
config = "aarch64-unknown-linux-gnu";
};
};
mkShell {
buildInputs = [ zlib ]; # your dependencies here
}
-
git clone https://github.com/NixOS/mobile-nixos.git
git clone https://github.com/NixOS/nixpkgs.git
cd nixpkgs
git checkout $revision
cd …/mobile-nixos/
export NIX_PATH=“nixpkgs=$HOME/nixpkgs”
5. ```nix-build --argstr device pine64-pinephone -A build.disk-image```
checking how to link with libunistring... -lunistring
checking for cmocka >= 1.0.0... no
checking for linker support for --wrap option... configure: error: in `/build/bind-9.16.8':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
HOSTCC tools/rksd.o
[ 22%] Built target aws-cpp-sdk-core
builder for '/nix/store/37w7p7kjca7dl851qrwd6ix0ihsdqg85-bind-9.16.8-aarch64-unknown-linux-gnu.drv' failed with exit code 1
cannot build derivation '/nix/store/hap38yykl6rxzajzxm65wp8zy4nbf78k-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/f2mggzpfw6pcrjii7zyfi097z1v6vhrd-nixos-system-nixos-21.03pre-git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/zb4g3q95zfwxc2n46j2gsdh6rqxsiy9a-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/p3l790l5y42gpngvc4iy8f3964r1hh91-partition-NIXOS_SYSTEM.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/qswqhrz64li98fclql870drzi2hhv494-disk-image-mobile-nixos.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2s5897zfkkz9m1q4zp8cjj6k7qvr2yd8-pine64-pinephone_full-disk-image.img.drv': 1 dependencies couldn't be built
error: build of '/nix/store/2s5897zfkkz9m1q4zp8cjj6k7qvr2yd8-pine64-pinephone_full-disk-image.img.drv' failed
But can not find the config.log in the filesystem
this 2 steps works:
nix-build --argstr device pine64-pinephone -A build.u-boot
file /nix/store/y2vnpw1kf0l6bvs98gzqdxszbwd9hjj2-uboot-pinephone_defconfig-2020.07-aarch64-unknown-linux-gnu/u-boot-sunxi-with-spl.bin
/nix/store/y2vnpw1kf0l6bvs98gzqdxszbwd9hjj2-uboot-pinephone_defconfig-2020.07-aarch64-unknown-linux-gnu/u-boot-sunxi-with-spl.bin: data
nix-build --argstr device pine64-pinephone -A build.boot-partition
file /nix/store/qw09ljs6xggk7bdq3pbvj7k9cv479rlc-partition-mobile-nixos-boot/mobile-nixos-boot.img
/nix/store/qw09ljs6xggk7bdq3pbvj7k9cv479rlc-partition-mobile-nixos-boot/mobile-nixos-boot.img: Linux rev 1.0 ext4 filesystem data, UUID=ed3902b6-920a-4971-bc07-966d4e021683, volume name “mobile-nixos-boo” (extents) (large files)
Since nixpkgs is a moving target it’s best to use a known good version. You can find one of these by looking here:
https://hydra.nixos.org/eval/1626589
(See also: https://github.com/NixOS/mobile-nixos/issues/93)
Thanks knedlsepp,
I tryed the Reproduce this build with: curl https://hydra.nixos.org/build/130184896/reproduce | bash
but did fail too.
https://hydra.nixos.org/build/130184896#tabs-summary
checking for xelatex... :
checking for latexmk... :
checking for pdflatex... no
checking for latexmk... (cached) :
checking for doxygen... no
checking for curl... curl
checking for cmocka >= 1.0.0... no
checking for linker support for --wrap option... configure: error: in `/build/bind-9.16.8':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
aarch64-unknown-linux-gnu-gcc -O2 -std=c99 -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPLUGIN_DEV -I.. -I../src -I./crypt -c control.c -o control.o
aarch64-unknown-linux-gnu-gcc -O2 -std=c99 -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPLUGIN_DEV -I.. -I../src -I./crypt -c dhcpcd.c -o dhcpcd.o
builder for '/nix/store/1p9yynv1xy7m5z88z3gndihcf1h7w8r0-bind-9.16.8-aarch64-unknown-linux-gnu.drv' failed with exit code 1
building '/nix/store/mvyv6sq1mpdj8jj09vmryf059gjxfcki-etc-fuse.conf.drv'...
cannot build derivation '/nix/store/ikg9y55mcsjvgp58vqx6z0ji8jpgdr6n-system-path.drv': 1 dependencies couldn't be built
building '/nix/store/jaa7w1d3mp49ryzwldvc1s0p7c4h894q-systemd-default-tmpfiles.drv'...
building '/nix/store/4brjjnsy4m2p1v3mjk6n7ik7fg306y5z-unit-audit.service.drv'...
building '/nix/store/hvxp430b2sj7m0z0xj8a897nj5a9yhsk-unit-console-getty.service-disabled.drv'...
building '/nix/store/j8mx6h9v1296wl8z1p2cf4vi0k4x3bqh-find-libs.drv'...
building '/nix/store/6k4hnzn48821ahxlw1ad4ms8g7jfhfqz-firmware.drv'...
building '/nix/store/rwmlaz04xsxfi66n0c2gk1hp116r7y2w-firmware.drv'...
building '/nix/store/98icw0mmkfb36dxyvbsb28cp85cqhdg2-installkernel.drv'...
cannot build derivation '/nix/store/gp1wm4k4vmd4j7j3hs8xcs2xic8499y0-nixos-system-nixos-21.03pre-git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/w5xphyf2gz4rsg9z2pazmn4wvk6sbvnd-nixos-system-nixos-21.03pre-git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/b9x40j2vb4np9x2har35dc53fp0adrqk-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/c9ifl1w0vwydlgxvpv8qrz8cnl8alqz0-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1xa5yap46lc47s4nsvajhlcw19pnlpnp-partition-NIXOS_SYSTEM.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/cxb3vyf01cyjglmg4qgppary2j4szabq-partition-NIXOS_SYSTEM.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/m40cq6zpwkxka6ffa8zgddkb6p75fbdp-android-device-asus-z00t.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/m097mq9m8rj48sv5910xf7h142a97y6s-disk-image-mobile-nixos-asus-dumo.drv': 1 dependencies couldn't be built
error: a 'aarch64-linux' with features {} is required to build '/nix/store/n35gnclgjdxa62wl70fhhvqszz52ilxp-installkernel.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}
You wouldn’t use the Reproduce this build option of Hydra.
You would rather use it to get a known good Nixpkgs revision, from the Inputs tab
This link should always point to the Inputs tab for the latest successful tested
aggregate job of Mobile NixOS.
Here you would have to somehow get it so <nixpkgs>
is the checkout for 24c9b05ac53e422f1af81a156f1fd58499eb27fb
An option is to have your working directories like:
/Projects
/mobile-nixos
/mobile-nixos <- actual mobile-nixos checkout
/nixpkgs <- actual nixpkgs checkout
And call nix-build -I nixpkgs=../nixpkgs [...]
or with the full path to the nixpkgs checkout.
For the nixpkgs
checkout, you’d clone Nixpkgs and git checkout 24c9b05ac53e422f1af81a156f1fd58499eb27fb
.
Does this help?
Why is the reproduce link not working though?
That’s because here it’s the aarch64 native rootfs. You’d need an aarch64 builder to build it .
Samuel thanks a lot!
I will try !
Hi Samuel,
got the 3 Images.
But the FULL Image looks like not OK.
nix-shell crossShell.nix
git clone https://github.com/NixOS/mobile-nixos.git
git checkout <revision>
git clone https://github.com/NixOS/nixpkgs.git
cd nixpkgs
git checkout 24c9b05ac53e422f1af81a156f1fd58499eb27fb
cd ../mobile-nixos/
export NIX_PATH="nixpkgs=$HOME/nixpkgs"
nix-build --argstr device pine64-pinephone -A build.disk-image -I nixpkgs=../nixpkgs
nix-build --argstr device pine64-pinephone -A build.boot-partition -I nixpkgs=../nixpkgs
nix-build --argstr device pine64-pinephone -A build.u-boot -I nixpkgs=../nixpkgs
sudo losetup /dev/loop2 zbkyvzqy1q4df3i9cii3pb1ic4f0zp37-pine64-pinephone_full-disk-image.img
sudo mount /dev/loop2 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
file /nix/store/zbkyvzqy1q4df3i9cii3pb1ic4f0zp37-pine64-pinephone_full-disk-image.img
/nix/store/zbkyvzqy1q4df3i9cii3pb1ic4f0zp37-pine64-pinephone_full-disk-image.img: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 2097219 sectors, extended partition table (last)
what did I wrong ?
sorry my fault!
If flashed now the Image: ```
zbkyvzqy1q4df3i9cii3pb1ic4f0zp37-pine64-pinephone_full-disk-image.img
to my sdcard, but the pinePhone did not boot.
Red led is on.
the sdcard looks like this:
Device Start End Sectors Size Type
/dev/sdb1 20514 22561 2048 1M unknown
/dev/sdb2 22562 55329 32768 16M unknown
/dev/sdb3 55330 317473 262144 128M Linux filesystem
/dev/sdb4 317474 2097185 1779712 869M Linux filesystem
write with dd to the sdcard:
sudo dd if=zbkyvzqy1q4df3i9cii3pb1ic4f0zp37-pine64-pinephone_full-disk-image.img of=/dev/sdb bs=8M oflag=sync,direct status=progress
My image is failing to boot as well with cross compilation from my x86_64 system.
I’ve taken the commits from Hydra - Build 134431266 of job mobile-nixos:unstable:tested (Hydra - Build 133813227 of job mobile-nixos:unstable:tested) at time of writing and done git checkout for those in both mobile-nixos and nixpkgs. From the constituents page (Hydra - Job mobile-nixos:unstable:tested) it looks like there is no tested build for the pine64-pinephone, but maybe I’m looking in the wrong place.
Then from the default mobile-nixos repository (no local.nix changes) I ran:
❯ nix-build --argstr device pine64-pinephone -A build.disk-image -I nixpkgs=../nixpkgs
/nix/store/zi7byci37dib41544kkihs4sy3q5dyaw-pine64-pinephone_full-disk-image.img
❯ sudo dd if=/nix/store/zi7byci37dib41544kkihs4sy3q5dyaw-pine64-pinephone_full-disk-image.img of=/dev/sdb status=progress
And inserted the sd-card to boot. The led turned solid red but no splash screen presented nor did it turn yellow as described in Pine64 PinePhone — Mobile NixOS. I left this running overnight to be sure.
I’m unsure of what steps I can even take at this point, any advice?