You are not logged in.

#1 2019-02-26 18:54:54

halasz
Member
From: france
Registered: 2015-01-17
Posts: 40

[SOLVED] Correct procedure to update custom kernel using abs/asp

I built my first custom kernel as explained in the wiki pages Arch Build System and Applying patches to add support for my old Radeon X1600 card on a MacBookPro2,1 as explained in this thread.  This worked fine and allowed me to boot in EFI mode without nomodeset

After last update which released new kernel though the system would not boot (it hung repeatedly restarting lightdm) so I assumed I needed to update the kernel to be in sync. 

I could not find instructions on how to do this with asp.  I tried repeating the steps from the wiki but got this fatal error when re-running the asp checkout linux step :

[adam@Transmission build]$  asp update linux
remote: Enumerating objects: 72, done.
remote: Counting objects: 100% (72/72), done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 68 (delta 28), reused 57 (delta 18)
Unpacking objects: 100% (68/68), done.
From https://git.archlinux.org/svntogit/packages
 * branch            packages/linux -> FETCH_HEAD
   eec0ccb..f2216ce  packages/linux -> packages/packages/linux
[adam@Transmission build]$ asp checkout linux
fatal: destination path 'linux' already exists and is not an empty directory.

This "error" is obviously reporting the truth as the linux directory was there from last time I built the kernel on 8th Feb and is not empty.  I checked to see if anything had been updated by the asp update linux but apparently not.  Note here I put the "build" directory on sdb1 as I didn't have enough space in my home directory which is the only thing I did differently to the wiki instructions.  As can be seen nothing has been updated in the last 10 days.  I checked in $ASPROOT (as described in the man pages) and this was also empty.

[adam@Transmission build]$ find /mnt/sdb1/build/ -mtime -1 -ls
[adam@Transmission build]$ find /mnt/sdb1/build/ -mtime -10 -ls
[adam@Transmission build]$ find /mnt/sdb1/build/ -mtime -20 -ls
  1703937      4 drwxr-xr-x   3  adam     adam         4096 Feb  8 12:03 /mnt/sdb1/build/
  1703938      4 drwxr-xr-x   5  adam     adam         4096 Feb  8 12:03 /mnt/sdb1/build/linux
  1703977      4 drwxr-xr-x   5  adam     adam         4096 Feb  8 12:03 /mnt/sdb1/build/linux/repos
  1703978      4 drwxr-xr-x   2  adam     adam         4096 Feb  8 12:03 /mnt/sdb1/build/linux/repos/core-i686
  1703984      4 -rw-r--r--   1  adam     adam          391 Feb  8 12:03 /mnt/sdb1/build/linux/repos/core-i686/linux.preset
  1703981    200 -rw-r--r--   1  adam     adam       201490 Feb  8 12:03 /mnt/sdb1/build/linux/repos/core-i686/config.i686
  1703979      4 -rw-r--r--   1  adam     adam          238 Feb  8 12:03 /mnt/sdb1/build/linux/repos/core-i686/90-linux.hook
...etc

Therefore I deleted linux directory from build and started again from scratch and all is working fine so far (it takes me about 7 hours to compile the kernel but it is going OK).

My question is, is this the correct procedure?  I should always delete linux from build before restarting the procedure to make a new kernel? 

If so does this mean I have to download everything again every time?  Or is my understanding of what asp update does wrong and it doesn't update files in the build directory?  In which case how can I tell if I'm compiling the correct version until it is done?

My apologies if this is obvious but I don't know how abs or git or asp or makepkg really work - I just follow the wiki and it is unclear what to do when compiling your second.

EDIT: Added the working patch for current version of radeon_bios.c (as of Feb 2019) as the thread linked above is now too old and closed so it can't be added there.  It may be useful for people using a MacBookPro2,1 with 32bit EFI where you can't boot Arch without nomodeset

diff -ura a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
--- a/drivers/gpu/drm/radeon/radeon_bios.c      2019-02-08 14:49:32.348705350 +0100
+++ b/drivers/gpu/drm/radeon/radeon_bios.c      2019-02-08 15:52:39.474545765 +0100
@@ -29,6 +29,7 @@
 #include "radeon_reg.h"
 #include "radeon.h"
 #include "atom.h"
+#include <linux/firmware.h>

 #include <linux/slab.h>
 #include <linux/acpi.h>
@@ -56,15 +57,18 @@
        vram_base = pci_resource_start(rdev->pdev, 0);
        bios = ioremap(vram_base, size);
        if (!bios) {
+                DRM_ERROR("No bios\n");
                return false;
        }

        if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+               DRM_ERROR("Invalid bios\n");
                iounmap(bios);
                return false;
        }
        rdev->bios = kmalloc(size, GFP_KERNEL);
        if (rdev->bios == NULL) {
+               DRM_ERROR("alloc fail\n");
                iounmap(bios);
                return false;
        }
@@ -73,6 +77,41 @@
        return true;
 }

+static bool radeon_read_bios_from_firmware(struct radeon_device *rdev)
+{
+       const uint8_t __iomem *bios;
+       resource_size_t size;
+       const struct firmware *fw = NULL;
+
+       request_firmware(&fw, "radeon/vbios.bin", rdev->dev);
+       if (!fw) {
+               DRM_ERROR("No bios\n");
+               return false;
+       }
+       size = fw->size;
+       bios = fw->data;
+
+       if (!bios) {
+               DRM_ERROR("No bios\n");
+               return false;
+       }
+
+       if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+               DRM_ERROR("wrong sig\n");
+               release_firmware(fw);
+               return false;
+       }
+       rdev->bios = kmalloc(size, GFP_KERNEL);
+       if (rdev->bios == NULL) {
+               DRM_ERROR("alloc fail\n");
+               release_firmware(fw);
+               return false;
+       }
+       memcpy(rdev->bios, bios, size);
+       release_firmware(fw);
+       return true;
+}
+
 static bool radeon_read_bios(struct radeon_device *rdev)
 {
        uint8_t __iomem *bios, val1, val2;
@@ -659,7 +698,9 @@
        bool r;
        uint16_t tmp;

-       r = radeon_atrm_get_bios(rdev);
+       r = radeon_read_bios_from_firmware(rdev);
+       if (r == false)
+               r = radeon_atrm_get_bios(rdev);
        if (r == false)
                r = radeon_acpi_vfct_bios(rdev);
        if (r == false)

Last edited by halasz (2019-03-17 21:30:05)

Offline

#2 2019-03-15 19:10:37

halasz
Member
From: france
Registered: 2015-01-17
Posts: 40

Re: [SOLVED] Correct procedure to update custom kernel using abs/asp

After some testing it appears that asp update linux doesn't update the existing source until after makepkg is run.  This means I don't have to delete and re-download the whole lot with asp checkput linux every time new kernel is released.

I ran asp update linux then makepkg -s and it was OK but I ws lucky as neither PKGBUILD or the program I'm patching changed.

Would it be best/normal practice to run asp update linux, makepkg -o (and so see if PKGBUILD or the program I'm patching has changed) and then run makepkg -s?

Or is there a better way of checking changes in advance?

Offline

#3 2019-03-15 21:08:09

goeb
Member
Registered: 2015-06-03
Posts: 16

Re: [SOLVED] Correct procedure to update custom kernel using abs/asp

You only need to run

asp checkout linux

once. After that, when you want to update your local sources, you can just run

asp update

followed by a

git pull

in the linux directory. Before pulling in the changes, you may want to

git stash

any local changes you made, and

git stash pop

them afterwards.

Offline

#4 2019-03-17 21:39:49

halasz
Member
From: france
Registered: 2015-01-17
Posts: 40

Re: [SOLVED] Correct procedure to update custom kernel using abs/asp

Thanks, using the git commands work fine and are clear.

The Arch Build System wiki page would be improved if information on what to do on second build was included (instructions for first build are clear) but I'm not qualified to update it.

Offline

Board footer

Powered by FluxBB