Olimex Support Forum

Others => TERES DIY Laptop => Topic started by: d3f on February 23, 2019, 09:31:20 PM

Title: can't build image, 3.10.104 and busybox
Post by: d3f on February 23, 2019, 09:31:20 PM
Hi there,

I've decided to try out building own image for teres following the instructions here -> https://github.com/OLIMEX/DIY-LAPTOP/blob/rel3/SOFTWARE/A64-TERES/scripts/Docker.md

All good, faced some difficulties(it was necessary to install qemu as well :) ) but when I plug the sd card(tried several) teres is not able to mount the rootfs:

mount: mounting /dev/mmcblk0p2 on /mnt/root failed: Invalid argument
umount: can't unmount /mnt/root: Invalid argument
Rootfs: /dev/mmcblk0p2
[   37.259701] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[   37.269247] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
[   37.288201] JBD2: Unrecognised features on journal
[   37.293429] EXT4-fs (mmcblk0p2): error loading journal
[   37.349186] UDF-fs: warning (device mmcblk0p2): udf_fill_super: No partition found (2)


Any idea what do I miss?

This works without any error
root@def-PC:~/Documents/teres/DIY-LAPTOP/SOFTWARE/A64-TERES/scripts# losetup /dev/loop29
/dev/loop29: [2053]:917515 (/home/def/Documents/teres/DIY-LAPTOP/SOFTWARE/A64-TERES/scripts/xenial-teres-bspkernel-20190223_201312_EET-1.img)
root@def-PC:~/Documents/teres/DIY-LAPTOP/SOFTWARE/A64-TERES/scripts# mount /dev/mapper/loop29p2 /mnt/teres
root@def-PC:~/Documents/teres/DIY-LAPTOP/SOFTWARE/A64-TERES/scripts# ls /mnt/teres
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var


Thanks,
Lazar
Title: Re: can't build image, 3.10.104 and busybox
Post by: khumarahn on February 24, 2019, 02:52:53 PM
The problem is with the old kernel: it does not fully support modern filesystems, including ext4; this is way worse with f2fs.

With ext4 the issue is with some journal features, but I do not recall which exactly. There is a way to mount ext4 with debug output and see, which features are not supported.

You may figure out what feature is not supported, and create a filesystem with this feature turned off.

With the old kernel, I ended up only mounting teres partitions on teres itself, and using rsync to update the data. That's mainly because of using f2fs. If I mount old-type f2fs partition on a newer kernel, it may become permanently screwed up.
Title: Re: can't build image, 3.10.104 and busybox
Post by: d3f on February 24, 2019, 04:22:48 PM
Thanks, that explains a lot the problem ...

I see in the script for making simple image a commit to fix may be the same issue -> https://github.com/OLIMEX/DIY-LAPTOP/commit/d4cdeafa744e7d7c1f04c9adfea1e6337520318b

mkfs.ext4 -F -O ^64bit,^csum_metadata -b 4096 -E stride=2,stripe-width=1024 -L rootfs ${out}2


I have tried that but I got strange error on the -O option. I will analyse more.

Also I see some similar issues and ideas:

--edit
This is what I get when I try with -O ^64bit,^csum_metadata, quotes doesn't help

mkfs.ext4 -F -O ^64bit,^csum_metadata -b 4096 -E stride=2,stripe-width=1024 -L rootfs teres.img2
mke2fs 1.44.1 (24-Mar-2018)
Invalid filesystem option set: ^64bit,^csum_metadata


--edit2
I got it resolved, simple fix on make_simpleimage.sh

dd if=/dev/zero bs=1M count=$((disk_size-boot_size-part_position/1024)) of=${out}2
- if [[ $(lsb_release -sc) == "bionic" ]]; then
- mkfs.ext4 -F -O ^64bit,^csum_metadata -b 4096 -E stride=2,stripe-width=1024 -L rootfs ${out}2
- else
- mkfs.ext4 -F -b 4096 -E stride=2,stripe-width=1024 -L rootfs ${out}2
+mkfs.ext4 -F -b 4096 -E stride=2,stripe-width=1024 -L rootfs ${out}2
+if [ "$(lsb_release -sc)" = "bionic" ]; then
+ tune2fs -O ^metadata_csum ${out}2
+ tune2fs -O ^64bit ${out}2
+ resize2fs -s ${out}2
fi
#kfs.ext4 -F -b 4096 -E stride=2,stripe-width=1024 -L rootfs ${out}2
dd if=${out}2 conv=notrunc oflag=append bs=1M seek=$((part_position/1024+boot_size)) of="$out"