edison-fw / meta-intel-edison

Here is the meta-intel-edison that builds, tries to stay up to date. Master is based on Yocto Poky Gatesgarth LTS 5.10.yy vanilla kernels. It builds a 32bit kernel (Gatesgarth branch 64bit) with ACPI enabled and corresponding rootfs. Telegram group: https://t.me/IntelEdison Web-site:
https://edison-fw.github.io/meta-intel-edison/
MIT License
60 stars 37 forks source link

Debian install linux-headers version problem #114

Closed shawnhsoia97 closed 3 years ago

shawnhsoia97 commented 4 years ago

Hi guys,I want to install linux-headers,because I need to build WiFi adapter driver. But I encountered some problems,I can't found the corresponding version. I have tried to run $sudo apt-get install linux-headers-$(uname -r) to get headers of current kernel version But Kernel version (uname -r) is 5.4.0-edison-acpi-standard,so can't found the corresponding version. How to solve it? Thank.

shawnhsoia97 commented 3 years ago

Looks to have installed.

yocto_btrfs$ cat out/linux64/build/tmp/deploy/images/edison/edison-image-edison.manifest | grep host
hostapd corei7-64 2.9-r0
libnss-myhostname2 corei7-64 1:243.2-r0
perl-module-net-hostent corei7-64 5.30.1-r0
perl-module-sys-hostname corei7-64 5.30.1-r0

But I am sure it is not install to edison-image-edison.ext4

Sstate summary: Wanted 25 Found 7 Missed 18 Current 2230 (28% match, 99% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
WARNING: edison-image-1.0-r0 do_rootfs: The license listed BSD3-Clause was not in the licenses collected for recipe sof-fw
NOTE: Tasks Summary: Attempted 5950 tasks of which 5885 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

Summary: There was 1 WARNING message shown.
./meta-intel-edison/utils/flash/postBuild.sh /mnt/yocto/yocto_btrfs/out/current/build
EDISON_ROOTFS_MB = , IMAGE_SIZE_MB = 1257
./meta-intel-edison/utils/flash/postBuild.sh: line 35: [: -lt: unary operator expected
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0138364 s, 303 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0116446 s, 360 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0109405 s, 383 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0116314 s, 361 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0127391 s, 329 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0138895 s, 302 MB/s
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0142471 s, 294 MB/s
Image Name:   Edison Updater script
Created:      Wed Aug 19 02:26:47 2020
Image Type:   PowerPC Linux Script (uncompressed)
Data Size:    22200 Bytes = 21.68 KiB = 0.02 MiB
Load Address: 00010000
Entry Point:  00010000
Contents:
   Image 0: 22192 Bytes = 21.67 KiB = 0.02 MiB
**** Done ***
Files ready to flash in /mnt/yocto/yocto_btrfs/out/current/build/toFlash/
Run the flashall script there to start flashing.

No matter how I IMAGE_INSTALL_append the package,theEDISON_ROOTFS_MB = , IMAGE_SIZE_MB = 1257 above will not change.

htot commented 3 years ago

You can look under build/tmp...hostapd, in the tmp directory are a order file with the build step and the build log files of each step. Also the directory structure that is used to build the packages.

Finally there is build/tmp.../edison-image, here the packages are installed, normally with dpkg, check this log here too. From this the image is built. hostapd should be there no matter the size of the image.

shawnhsoia97 commented 3 years ago

I checked build/tmp.../edison-image,the package is here.

yocto_btrfs/out/linux64/build/tmp/work/edison-poky-linux/edison-image/1.0-r0$ cat image_initial_manifest | grep hostapd
mip,hostapd

but my edison there is not the package after flash image . I tied build and flash branch zeus ,that is normally.

WARNING: edison-image-1.0-r0 do_rootfs: The license listed BSD3 was not in the licenses collected for recipe sof-fw
NOTE: Tasks Summary: Attempted 5702 tasks of which 5394 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.
./meta-intel-edison/utils/flash/postBuild.sh /mnt/yocto/yocto_zeus_original/out/current/build
EDISON_ROOTFS_MB = 1538, IMAGE_SIZE_MB = 1535
1+0 records in
1+0 records out

Strange,branch zeus and btrfs should be the same,right? Can you try toIMAGE_INSTALL_append some package on branch btrfs?

htot commented 3 years ago

In one case you have:

EDISON_ROOTFS_MB = , IMAGE_SIZE_MB = 1257

in the other:

EDISON_ROOTFS_MB = 1538, IMAGE_SIZE_MB = 1535

That is strange, maybe you are right and you need to increase the size of the image. I can only think of here.

shawnhsoia97 commented 3 years ago

Ok,I tried this solution.

/yocto_btrfs$ cat meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image-minimal.bb | grep IMAGE_ROOTFS_SIZE
IMAGE_ROOTFS_SIZE = "1048576"
IMAGE_ROOTFS_SIZE = "1048576"

but that not solve.


WARNING: edison-image-1.0-r0 do_rootfs: The license listed BSD3-Clause was not in the licenses collected for recipe sof-fw
NOTE: Tasks Summary: Attempted 5765 tasks of which 5701 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 1 seconds

Summary: There was 1 WARNING message shown.
./meta-intel-edison/utils/flash/postBuild.sh /mnt/yocto/yocto_btrfs/out/current/build
EDISON_ROOTFS_MB = , IMAGE_SIZE_MB = 1127
./meta-intel-edison/utils/flash/postBuild.sh: line 35: [: -lt: unary operator expected
1+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0110244 s, 380 MB/s

Maybe this question is on edison.env?Because you delete partition define?I guess.

htot commented 3 years ago

I don't understand what you are doing, you need to be more clear. When you grep you get the variable IMAGE_ROOTFS_SIZE 2 times (should be one), and you wanted to increase the value but it is still 1048576.

You do understand that the whole rootfs under build/tmp.../edison-image is copied into a file containing an ext4 image right?

If you don't trust it why not go into out/linux64/build/tmp/deploy/images/edison/ and mount the edison-image-edison.ext4 (create tmp directory and mount edison-image-edison.ext4 tmp) then go look in tmp for missing files.

shawnhsoia97 commented 3 years ago

Sorry, I am so foolish,I hope that you can excuse my foolish behavior. No,I was not understand what your mean.I apologize.I understand what your mean now.

Now I change IMAGE_ROOTFS_SIZE to 10048576.(will I set too large?) And then I get:

WARNING: edison-image-1.0-r0 do_rootfs: The license listed BSD3-Clause was not in the licenses collected for recipe sof-fw
NOTE: Tasks Summary: Attempted 5765 tasks of which 5701 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

Summary: There was 1 WARNING message shown.
./meta-intel-edison/utils/flash/postBuild.sh /mnt/yocto/yocto_btrfs/out/current/build
EDISON_ROOTFS_MB = , IMAGE_SIZE_MB = 9813
./meta-intel-edison/utils/flash/postBuild.sh: line 35: [: -lt: unary operator expected
1+0 records in

But I found keep increasing IMAGE_ROOTFS_SIZE and also IMAGE_SIZE_MB will keep increasing,that without limit.

htot commented 3 years ago

Ok, no problem. Can you check tmp/out/linux64/build/tmp/work/edison-poky-linux/edison-image/1.0-r0/rootfs/ if you can find hostapd*?

shawnhsoia97 commented 3 years ago

Yes,I can found hostapd*,now I found hostapd in my Edison. I don't think it make sense to increase IMAGE_ROOTFS_SIZE,the reason should be that there was a problem with my file,but it is resolved now,Thank.

But I have the new problem,when installed more package,appeared edison-image-edison.btrfs is too big.I don't understand what I should have more space ,right?

images/edison$ sudo dfu-util -v -d 8087:0a99 --alt home -D edison-image-edison.btrfs
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: File size is too big: Success

Also if I have flashed ext4 image and installed btrfs image once. When I want update brifs image ,can I just do sudo dfu-util -v -d 8087:0a99 --alt home -D edison-image-edison.btrfs ? don't reflash ext4 image.

htot commented 3 years ago

But I have the new problem,when installed more package,appeared edison-image-edison.btrfs is too big.I don't understand what I should have more space ,right?

dfu-util: File size is too big: Success

The partition is too small probably. Try partx /dev/mmcblk0 to see the partitions. Also if I have flashed ext4 image and installed btrfs image once. When I want update brifs image ,can I just do sudo dfu-util -v -d 8087:0a99 --alt home -D edison-image-edison.btrfs ? don't reflash ext4 image.

Yes, that should work.

shawnhsoia97 commented 3 years ago

This is size of partition if edison-image-edison.btrfs = 1981MB

 partx /dev/mmcblk0
NR  START     END SECTORS SIZE NAME        UUID
 1   2048    6143    4096   2M u-boot0     0b484ad1-10d8-404f-ba7e-ccead78a7ac6
 2   6144    8191    2048   1M u-boot-env0 269de5cf-537d-de4d-9cea-9bec786dcca8
 3   8192   12287    4096   2M u-boot1     fa474346-c071-574e-b954-c47510693215
 4  12288   14335    2048   1M u-boot-env1 71f2d63f-5705-4d41-9d53-498988f37ec6
 5  14336   16383    2048   1M factory     5d62fae6-44d9-4549-a81f-28c14abf6a9a
 6  16384   65535   49152  24M panic       0d195330-516f-c847-b2a6-ee75a26a3685
 7  65536  196607  131072  64M boot        b55a5768-3ed3-0942-b74b-879f6390dbab
 8 196608 7634910 7438303 3.6G home        dc317641-c89d-ad4c-ba2d-21add117539a

dfu-util: File size is too big: Success ,if edison-image-edison.btrfs = 2557MB

images/edison$ sudo dfu-util -v -d 8087:0a99 --alt home -D edison-image-edison.btrfs
[sudo] password for bovia: 
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: File size is too big: Success

Maybe is my computer memory is too small?because I not connect the 2 USB cable to the USB port,that also get this error if edison-image-edison.btrfs = 2557MB,but if edison-image-edison.btrfs = 1981MB,that not get any error,that is just wait USB connect.

htot commented 3 years ago

I see. Maybe there is a 2GB limit for dfu-util? I haven't tried that size.

Would it work for you to boot the rescue image, then copy the btrfs image from the sd card to the emmc using dd?

shawnhsoia97 commented 3 years ago

Maybe you are right.I found this #32 Support for files greater than 2GB ,but I not understand how to do .

I try increase my swap file to 4GB,but not effective.

Also I tried do sudo dd if=edison-image-edison.btrfs of=/dev/mmcblk0,but I don't sure what I'm doing is correct. I get this: [ 316.118642] systemd-journald[493]: Failed to write entry (21 items, 563 bytes), ignoring: Read-only file system

htot commented 3 years ago

You would need to write a patch for dfu-util...

Don't dd to a live file system, that will crash. Boot from u-boot into the rescue file system. That is on p7 and will let you umount /dev/mmcblk0p8. Then dd the file from the sdhc card to /dev/mmcblk0p8

shawnhsoia97 commented 3 years ago

Ok,I successfully installed btrfs.image to /dev/mmcblk0p8.

But this solution is a bit complicated,I should keep look for dfu-util solution.

Thank your help.

htot commented 3 years ago

We can do btrfs send/receive to a live file system, this will send a new (bootable snapshot).

This is what I aim for.

But keep in mind that after sending, old and new snapshot both exist and take up space on the filesystem.

So in your case, you would want probably a small bootable snapshot providing network access that allows ssh and btrfs receiveof the full image. In case you want to update the image, reboot into the small image, delete the old large snapshot, then btrfs receive the new one.

shawnhsoia97 commented 3 years ago

Ok,I did send a new,but when I try to booting the @new that get error:

=> run do_altboot
## Error: "do_altboot" not defined

Also I try "Send snapshot to Edison" in step,I should ssh root@edison.local "mount /dev/disk/by-partlabel/home /mnt" instead of ssh root@edison.local "mount /dev/disk/by-partlabel/rootfs /mnt" ,right?

How to delete the old large snapshot?

htot commented 3 years ago

If you have this env you should have altboot.

But you are right, you need to mount by-partlabel/home.

To delete the old large snapshot, reboot into @new, mount by-partlabel/home to mnt again, btrfs remove @ in that dir, and if you like btrfs snapshot @new to create a new @ from @new. Then reboot into @ and then btrfs remove @new.

shawnhsoia97 commented 3 years ago

may your mean is run altboot?because I not found do_altboot in this

But I try to run altboot also get error:

=> run altboot        
Cannot lookup file /@boot/bzImageNew
Cannot lookup file /@boot/initrdNew
Error: Invalid Boot Flag (found 0xffef, expected 0xaa55)
## Kernel loading failed ...
zboot - Boot bzImage

Usage:

zboot [addr] [size] [initrd addr] [initrd size]
      addr -        The optional starting address of the bzimage.
                    If not set it defaults to the environment
                    variable "fileaddr".
      size -        The optional size of the bzimage. Defaults to
                    zero.
      initrd addr - The address of the initrd image to use, if any.
      initrd size - The size of the initrd image to use, if any.

Is the @ mean to old large snapshot?so I need to does btrfs remove /mnt , is that mean remove @?then replay btrfs send/receive to creat new snapshot in @new?but I need change the new snapshot name,right?

Sorry I not sure I understand your mean. Thank you.

htot commented 3 years ago

You are right run altboot is the correct command.

With btrfs in general it seems to be customary to use @ as the first char of a snapshot. And most snapshots can be found in the root. So mnt /dev/sdax /mnt and ls /mnt will show you @, @boot, @home. So you know you can also mnt -o subvol=@home /dev/sdax /mnt. And will directly mount @home on mnt. In this you see:

  1. rootfs is found here root=/dev/mmcblk0p8 rootflags=subvol=@new
  2. kernel is found here load mmc 0:8 ${loadaddr} /@boot/bzImageNew
  3. initrd is found here load mmc 0:8 0x6000000 /@boot/initrdNew

In your case you need to make symlinks in @boot manually.

I never said my btrfs instructions are correct or complete, it is a work in progress :-)

shawnhsoia97 commented 3 years ago

Okay,I hope I am a little helpful in this work ^_^ I try to below step,but I not sure this is correct:

Last login: Thu Aug 13 17:10:03 CST 2020 on ttyS2
root@edison:~# mount /dev/mmcblk0p8 /mnt/
root@edison:~# ln /mnt/@
@/        @boot/    @home/    @modules/ @new/     
root@edison:~# ln -s /mnt/@boot/ /mnt/@new/@boot

And I think should take load_altboot=load mmc 0:8 ${loadaddr} /@boot/bzImage;load mmc 0:8 0x6000000 /@boot/initrd instead of load_altboot=load mmc 0:8 ${loadaddr} /@boot/bzImageNew;load mmc 0:8 0x6000000 /@boot/initrdNew

Now I into the @new:

=> run altboot
10169120 bytes read in 479 ms (20.2 MiB/s)
9541041 bytes read in 425 ms (21.4 MiB/s)
Valid Boot Flag
Setup Size = 0x00003800
Magic signature found
Using boot protocol version 2.0f
Linux kernel version 5.6.0-edison-acpi-standard (oe-user@oe-host) #1 SMP Tue Sep 1 03:23:18 UTC 2020
Building boot_params at 0x00090000
Loading bzImage at address 100000 (10154784 bytes)
Magic signature found
Initial RAM disk at linear address 0x06000000, size 25165824 bytes
Kernel command line: "quiet debugshell=10 tty1 console=ttyS2,115200n8 root=/dev/mmcblk0p8 rootflags=subvol=@new rootfstype=btrfs systemd.unit=multi-user.target hardware_id=00"
Magic signature found

Starting kernel ...

[    2.396437] Initramfs unpacking failed: invalid magic at start of compressed archive
Scanning for Btrfs filesystems
Starting version 243.2+
Kernel with acpi enabled detected
Loading acpi tables
[    3.666306] pca953x i2c-INT3491:01: failed writing register
Waiting for root device /dev/mmcblk0p8
  10Found device '/run/media/mmcblk0p8'

But that crash to here,that is stop.I remove some package ,maybe I remove package that shouldn't be removed? :

[  OK  ] Started Network Service.
[  OK  ] Reached target Network.
[FAILED] Failed to start Set timezone by geolocation service.
See 'systemctl status run-timezone.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[  OK  ] Stopped Create Volatile Files and Directories.
[  OK  ] Stopped target Local File Systems.
[  OK  ] Unset automount home.automount.
         Unmounting /factory...
         Unmounting Temporary Directory (/tmp)...
         Unmounting /var/volatile...
[  OK  ] Unmounted /factory.
[  OK  ] Unmounted Temporary Directory (/tmp).
[  OK  ] Unmounted /var/volatile.
[  OK  ] Unset automount factory.automount.
[  OK  ] Stopped target Swap.
[  OK  ] Reached target Unmount All Filesystems.
[  OK  ] Reached target Final Step.
[  OK  ] Stopped File System Check …dev/disk/by-partlabel/factory.
[  OK  ] Removed slice system-systemd\x2dfsck.slice.
[  OK  ] Stopped target Local File Systems (Pre).
[  OK  ] Stopped Remount Root and Kernel File Systems.
[  OK  ] Stopped Create Static Device Nodes in /dev.
htot commented 3 years ago

The idea was to allow booting multiple kernels / initrd. So bzImage and bzImageNew. In your case bzImageNew does not exist, don't ln the directory, but go into @boot and make symlink from your kernel to bzImageNew. Same for initrd.

shawnhsoia97 commented 3 years ago

OKay,I get it.Thank you!

And I have a one problem,which Failed to start systemd-tmpfiles in branch zeus. I found this is "Permission denied",systemd-tmpfiles won't execute.I am understand what can usechmod +x to increase permission of systemd-tmpfiles,but I hope to repair in Yocto ,and which is normal in branch warrior.

htot commented 3 years ago

I have:

root@yuna:~# systemctl status systemd-tmpfiles-setup
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
   Loaded: loaded (/lib/systemd/system/systemd-tmpfiles-setup.service; static; vendor preset: disabled)
   Active: active (exited) since Thu 2020-07-23 08:52:21 CEST; 1 months 23 days ago
     Docs: man:tmpfiles.d(5)
           man:systemd-tmpfiles(8)
  Process: 534 ExecStart=/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS)
 Main PID: 534 (code=exited, status=0/SUCCESS)

Jul 23 08:52:21 yuna systemd[1]: Starting Create Volatile Files and Directories...
Jul 23 08:52:21 yuna systemd-tmpfiles[534]: /etc/tmpfiles.d/connman_resolvconf.conf:1: Line references path below legacy directory /var/run/, updati>
Jul 23 08:52:21 yuna systemd[1]: Started Create Volatile Files and Directories.

Seems OK to me.

shawnhsoia97 commented 3 years ago

I don't know how to happen this problem,but I clone the new branch again,which become to normal.

Thank so much for your help at the all time!!

htot commented 3 years ago

No problem. Don't forget to contribute your results in the form of a PR.