您尚未登录。

#16 2023-12-05 17:19:13

qileilu
会员
注册时间: 2012-10-12
帖子: 107

Re: 办公室统一换电脑了,arm架构,我希望我还能再来论坛

这几周使用kylin系统里的/proc/config.gz(详见#14楼)编译了诸多内核,官方的从5.4、5.10到6.0、6.6等等,有的是直接编译出错,有的是编译成功,但是启动系统后网络声音全无,不过还是能启动archlinux系统。
我还试了phytium官方gitee上的嵌入式软件 / Phytium-Linux-Kernel(5.10)飞腾信息技术有限公司 / linux(6.1.y)不管是用自带的config还是我kylin上的config编译出来的核都无法正常启动Archlinux系统,我估计是那些嵌入板用的内核,不适合我这种“pc机”就没有再继续深究下去了。

试了那么多,其中5.10还算成功,网络成功驱动,声音不行。显卡的问题最后再说。
我用的PKGBUILD是照着HougeLangley/phytium-kernel-archlinux 的修改的,这里我学到了很多。
我修改后的PKGBUILD如下:

# AArch64 Phytium
# Maintainer: hougelangley1987@gmail.com

buildarch=8

pkgbase=linux-phytium
_srcname=linux-5.10
_kernelname=${pkgbase#linux}
_desc="AArch64 phytium-platform"
kernelversion=5.10
pkgver=5.10.153
pkgrel=2
arch=('aarch64')
url="http://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'vboot-utils' 'dtc' 'clang' 'llvm' 'lld' 'python' )
options=('!strip')
source=("https://mirrors.ustc.edu.cn/kernel.org/linux/kernel/v5.x/${_srcname}.tar.xz"
        "https://mirrors.ustc.edu.cn/kernel.org/linux/kernel/v5.x/patch-${pkgver}.xz"
        'lc-phytium-config'
        '0001-add-phytium-id-from-acpi-to-stmmac.patch'
        '0002-phytium-ethernet-stmmac.patch'
        'linux.preset'
        '60-linux.hook'
        '90-linux.hook')
md5sums=('753adc474bf799d569dec4f165ed92c3'
         'f400313ced2deda18335757c6a3c4cf8'
         '34a34c8cf7f5f443b9e9c369c50eb8dc'
         'd1992b5aaf28b2ee0a8e4fbd4516dcc4'
         'c15f20cf6a6da0d70a1dd738fbc6ff4b'
         '41cb5fef62715ead2dd109dbea8413d6'
         '0a5f16bfec6ad982a2f6782724cca8ba'
         '3dc88030a8f2f5a5f97266d99b149f77')

prepare() {
  cd $_srcname

  echo "Setting version..."
  scripts/setlocalversion --save-scmversion
  echo "-$pkgrel" > localversion.10-pkgrel
  echo "${pkgbase#linux}" > localversion.20-pkgname

  # Apply patch
  patch -Np1 -i ../patch-${pkgver}

  # Apply bbr2 patch
   patch -Np1 -i ../0001-add-phytium-id-from-acpi-to-stmmac.patch
   patch -Np1 -i ../0002-phytium-ethernet-stmmac.patch

    
  # apply Phytium UOS kernel config, you could custom
  cat "${srcdir}/lc-phytium-config" > ./.config
  make olddefconfig
  make menuconfig

}

build() {
  cd ${_srcname}

  # get kernel version
  make prepare
  make -s kernelrelease > version

  # build!
  unset LDFLAGS
  make ${MAKEFLAGS} Image Image.gz modules
  # Generate device tree blobs with symbols to support applying device tree overlays in U-Boot
  make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
}

_package() {
  pkgdesc="The Linux Kernel and modules - ${_desc}"
  depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
  optdepends=('crda: to set the correct wireless channels of your country')
  provides=("linux=${pkgver}" "WIREGUARD-MODULE")
  replaces=('linux-armv8')
  conflicts=('linux')
  backup=("etc/mkinitcpio.d/${pkgbase}.preset")
  install=${pkgname}.install

  cd $_srcname
  local kernver="$(<version)"
  local modulesdir="$pkgdir/usr/lib/modules/$kernver"

  echo "Installing boot image and dtbs..."
  install -Dm644 arch/arm64/boot/Image{,.gz} -t "${pkgdir}/boot"
  make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install

  echo "Installing modules..."
  make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install

  # remove build and source links
  rm "$modulesdir"/{source,build}

  # sed expression for following substitutions
  local _subst="
    s|%PKGBASE%|${pkgbase}|g
    s|%KERNVER%|${kernver}|g
  "

  # install mkinitcpio preset file
  sed "${_subst}" ../linux.preset |
    install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"

  # install pacman hooks
  sed "${_subst}" ../60-linux.hook |
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
  sed "${_subst}" ../90-linux.hook |
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
}

_package-headers() {
  pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}"
  provides=("linux-headers=${pkgver}")
  conflicts=('linux-headers')

  cd $_srcname
  local builddir="$pkgdir/usr/lib/modules/$(<version)/build"

  echo "Installing build files..."
  install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
    localversion.* version vmlinux
  install -Dt "$builddir/kernel" -m644 kernel/Makefile
  install -Dt "$builddir/arch/arm64" -m644 arch/arm64/Makefile
  cp -t "$builddir" -a scripts

  # add xfs and shmem for aufs building
  mkdir -p "$builddir"/{fs/xfs,mm}

  echo "Installing headers..."
  cp -t "$builddir" -a include
  cp -t "$builddir/arch/arm64" -a arch/arm64/include
  install -Dt "$builddir/arch/arm64/kernel" -m644 arch/arm64/kernel/asm-offsets.s
  mkdir -p "$builddir/arch/arm"
  cp -t "$builddir/arch/arm" -a arch/arm/include

  install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h

  # https://bugs.archlinux.org/task/13146
  install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h

  # https://bugs.archlinux.org/task/20402
  install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h

  # https://bugs.archlinux.org/task/71392
  install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h

  echo "Installing KConfig files..."
  find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;

  echo "Removing unneeded architectures..."
  local arch
  for arch in "$builddir"/arch/*/; do
    [[ $arch = */arm64/ || $arch == */arm/ ]] && continue
    echo "Removing $(basename "$arch")"
    rm -r "$arch"
  done

  echo "Removing documentation..."
  rm -r "$builddir/Documentation"

  echo "Removing broken symlinks..."
  find -L "$builddir" -type l -printf 'Removing %P\n' -delete

  echo "Removing loose objects..."
  find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete

  echo "Stripping build tools..."
  local file
  while read -rd '' file; do
    case "$(file -bi "$file")" in
      application/x-sharedlib\;*)      # Libraries (.so)
        strip -v $STRIP_SHARED "$file" ;;
      application/x-archive\;*)        # Libraries (.a)
        strip -v $STRIP_STATIC "$file" ;;
      application/x-executable\;*)     # Binaries
        strip -v $STRIP_BINARIES "$file" ;;
      application/x-pie-executable\;*) # Relocatable binaries
        strip -v $STRIP_SHARED "$file" ;;
    esac
  done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)

  echo "Adding symlink..."
  mkdir -p "$pkgdir/usr/src"
  ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}

pkgname=("${pkgbase}" "${pkgbase}-headers")
for _p in ${pkgname[@]}; do
  eval "package_${_p}() {
    _package${_p#${pkgbase}}
  }"
done

其中的0001-add-phytium-id-from-acpi-to-stmmac.patch和0002-phytium-ethernet-stmmac.patch来源于铜豌豆 Linux / atzlinux-kernel,这两个patch打上之后可以成功开启网络驱动,这里的其他patch试了一些,有的可能版本问题编译不成功,有的编译成功了没效果,目前和没有找到开启声音的办法。
其中的lc-phytium-config就是kylin系统里的/proc/config.gz。
其中的linux.preset、60-linux.hook、90-linux.hook就是HougeLangley/phytium-kernel-archlinux 里的文件未作修改。顺便说一下直接按照大神的phytium-config我也编译过,网络声音驱动不了,但是能成功启动archlinux.

用makepkg -Ccs编译,成功后在通过pacman -U安装对应的linux-phytium-5.10.153-2-aarch64.pkg.tar.xz包和linux-phytium-headers-5.10.153-2-aarch64.pkg.tar.xz包即可。

最后说一下显卡问题:
我的显卡是:JINGJIA MICRO JM7201 1G(详见#1楼)
通过搜索其核心芯片是mwv206。
景嘉微官方没有提供驱动,在gitee的找到老虎会游泳 / mwv206,应该没有错。
可是archlinux下编译不了,查了下源码,人家支持kylin、vos、deepin、neokylin这几个,典型的专用服务,其他的编不了。于是我切换到kylin下编译,果然没任何问题,然后按照其makeinstall的路径把相关文件复制到archlinux文件目录的对应位置(这是典型的不当操作,大神不要喷我),结果还是不能驱动显卡。
后来查到据说这个显卡有核内驱动和核外驱动,那还得去内核编译着手吗?
但我这个直接从kylinboot目录下拿来5.4.18-85-generic #74-KYLINOS 核显卡驱动的蛮好的呀!我是不是就该老老实实的用这个kylin的5.4.18核算了,唉
革命尚未成功,同志尚需努力!!

最近编辑记录 qileilu (2023-12-05 17:27:58)

离线

#17 2023-12-14 16:28:09

qileilu
会员
注册时间: 2012-10-12
帖子: 107

Re: 办公室统一换电脑了,arm架构,我希望我还能再来论坛

搞不定硬件的驱动问题,那就搞定产生问题的硬件:

昨天换掉号称1G显存的景嘉微显卡:JINGJIA MICRO JM7201 1G,换上2G显存的AMD Oland [Radeon HD 8570 / R5 430 OEM R7 240/340 Radeon 520 OEM]
657aafd2c458853aef073fe3.jpg

这样一下子解决了两个问题:
1.放弃难啃的mwv206显卡驱动,换开源的AMD驱动,搞定非kylin内核下的显示问题。
2.音响接显示器的音频输出,通过显卡hdmi出声,完全绕开内核声卡,声音问题解决。

接下来详细说一说这个JINGJIA MICRO JM7201 1G显卡。为了避免驱动问题的影响,以下均是在kylin系统完美优化驱动下输出。

部分inxi -Fxxxz命令输出如下:

System:    Kernel: 5.4.18-85-generic aarch64 bits: 64 compiler: gcc v: 9.4.0 Desktop: UKUI 2.0.11-7 
           info: ukui-panel, cairo-dock wm: KWin dm: LightDM 1.30.0 Distro: Kylin v10 银河麒麟桌面操作系统V10 (SP1) 
Machine:   Type: Desktop System: 湖南湘江鲲鹏信息科技有限责任公司 product: D110-F21A v: 1.0.0 serial: <filter> 
           Mobo: N/A model: L21K-2041K serial: <filter> UEFI: ZD-TECH v: KL4.27.KP.D.062.D date: 03/11/2022 
CPU:       Topology: 8-Core model: Phytium D2000/8 E8C bits: 64 type: MCP arch: ARMv8 rev: 3 
           features: Use -f option to see features bogomips: 768 
           Speed: 2300 MHz min/max: 575/2300 MHz Core speeds (MHz): 1: 2300 2: 2300 3: 2300 4: 2300 5: 2300 6: 2300 7: 2300 
           8: 2300 
Graphics:  Device-1: Jingjia Micro Co JM7200 Series GPU driver: mwv206 v: 2.1.6-20220310.1700 bus ID: 04:00.0 
           chip ID: 0731:7200 
           Display: x11 server: X.Org 1.20.8 driver: none unloaded: fbdev,modesetting resolution: 1920x1080~60Hz 
           OpenGL: renderer: MWV206 v: 3.0 JMGPU direct render: Yes 
Audio:     Device-1: ft-hda driver: ft-hda message: bus/chip ids unavailable 
           Device-2: HDMI_1  driver: MWV206 HDMI_1 message: bus/chip ids unavailable 
           Sound Server: ALSA v: k5.4.18-85-generic 
Network:   Message: No ARM data found for this feature. 
           IF-ID-1: docker0 state: down mac: <filter> 
           IF-ID-2: enaphyt4i0 state: up speed: 100 Mbps duplex: full mac: <filter> 
           IF-ID-3: ip6tnl0 state: down mac: <filter> 
           IF-ID-4: sit0 state: down mac: <filter> 

lspci -v -s 命令输出如下:
657ab6bec458853aef22a10c.jpg

结论:
1.看这lspci -v -s输出是不是可以理解为:这款号称1G显存的显卡,实际使用的显存只有256M?
2.景嘉微显卡的glmark2得分仅有101,还不如原来联想去掉显卡后的核显得分102,比amd显卡的glmark2 Score: 2728更是差太远了!!!
3.实际游戏体验,以linux的赛车游戏SuperTuxKart为例,JM7200显卡下,普通赛道,1辆车,出发3秒倒计时,需要15秒!!!完全不能动,压根玩不了。而amd卡下选满20辆车,毫无压力。

最近编辑记录 qileilu (2023-12-14 16:47:13)

离线

#18 2024-05-05 12:57:29

Kapitalismus
封禁
注册时间: 2024-05-05
帖子: 5

Re: 办公室统一换电脑了,arm架构,我希望我还能再来论坛

干脆直接装debian 再把内核搬过去🌝或者干脆再买个电脑搬到办公室去🌝

离线

#19 2024-06-09 23:20:41

BreadCat209
K.I.S.S.
注册时间: 2023-09-09
帖子: 136

Re: 办公室统一换电脑了,arm架构,我希望我还能再来论坛

qileilu 说:

搞不定硬件的驱动问题,那就搞定产生问题的硬件:

昨天换掉号称1G显存的景嘉微显卡:JINGJIA MICRO JM7201 1G,换上2G显存的AMD Oland [Radeon HD 8570 / R5 430 OEM R7 240/340 Radeon 520 OEM]
https://pic.imgdb.cn/item/657aafd2c458853aef073fe3.jpg

这样一下子解决了两个问题:
1.放弃难啃的mwv206显卡驱动,换开源的AMD驱动,搞定非kylin内核下的显示问题。
2.音响接显示器的音频输出,通过显卡hdmi出声,完全绕开内核声卡,声音问题解决。

接下来详细说一说这个JINGJIA MICRO JM7201 1G显卡。为了避免驱动问题的影响,以下均是在kylin系统完美优化驱动下输出。

部分inxi -Fxxxz命令输出如下:

System:    Kernel: 5.4.18-85-generic aarch64 bits: 64 compiler: gcc v: 9.4.0 Desktop: UKUI 2.0.11-7 
           info: ukui-panel, cairo-dock wm: KWin dm: LightDM 1.30.0 Distro: Kylin v10 银河麒麟桌面操作系统V10 (SP1) 
Machine:   Type: Desktop System: 湖南湘江鲲鹏信息科技有限责任公司 product: D110-F21A v: 1.0.0 serial: <filter> 
           Mobo: N/A model: L21K-2041K serial: <filter> UEFI: ZD-TECH v: KL4.27.KP.D.062.D date: 03/11/2022 
CPU:       Topology: 8-Core model: Phytium D2000/8 E8C bits: 64 type: MCP arch: ARMv8 rev: 3 
           features: Use -f option to see features bogomips: 768 
           Speed: 2300 MHz min/max: 575/2300 MHz Core speeds (MHz): 1: 2300 2: 2300 3: 2300 4: 2300 5: 2300 6: 2300 7: 2300 
           8: 2300 
Graphics:  Device-1: Jingjia Micro Co JM7200 Series GPU driver: mwv206 v: 2.1.6-20220310.1700 bus ID: 04:00.0 
           chip ID: 0731:7200 
           Display: x11 server: X.Org 1.20.8 driver: none unloaded: fbdev,modesetting resolution: 1920x1080~60Hz 
           OpenGL: renderer: MWV206 v: 3.0 JMGPU direct render: Yes 
Audio:     Device-1: ft-hda driver: ft-hda message: bus/chip ids unavailable 
           Device-2: HDMI_1  driver: MWV206 HDMI_1 message: bus/chip ids unavailable 
           Sound Server: ALSA v: k5.4.18-85-generic 
Network:   Message: No ARM data found for this feature. 
           IF-ID-1: docker0 state: down mac: <filter> 
           IF-ID-2: enaphyt4i0 state: up speed: 100 Mbps duplex: full mac: <filter> 
           IF-ID-3: ip6tnl0 state: down mac: <filter> 
           IF-ID-4: sit0 state: down mac: <filter> 

lspci -v -s 命令输出如下:
https://pic.imgdb.cn/item/657ab6bec458853aef22a10c.jpg

结论:
1.看这lspci -v -s输出是不是可以理解为:这款号称1G显存的显卡,实际使用的显存只有256M?
2.景嘉微显卡的glmark2得分仅有101,还不如原来联想去掉显卡后的核显得分102,比amd显卡的glmark2 Score: 2728更是差太远了!!!
3.实际游戏体验,以linux的赛车游戏SuperTuxKart为例,JM7200显卡下,普通赛道,1辆车,出发3秒倒计时,需要15秒!!!完全不能动,压根玩不了。而amd卡下选满20辆车,毫无压力。

虽然但是,这是什么奇妙的小游戏啊


[mbm@ArchLinux:~]$ sudo rm -rf /*

离线

页脚