海运的博客

n1盒子ubuntu使用netplan配置wifi无线连接

发布时间:October 25, 2018 // 分类:N1 // 2 Comments

ubuntu 18.04使用netplan配置网络信息,后端使用Network Manager或systemd-networkd管理网络,默认使用systemd-networkd,systemd-networkd本身不支持无线,使用wpasupplicant连接无线。

apt install iproute2 wpasupplicant

查看无线网卡名称:

iw dev          

网卡名称为wlan0,开启:

ip lin set wlan0 up

搜索路由ssid:

iw dev wlan0 scan

netplan配置:

network:
  version: 2
  renderer: networkd
  wifis:
    wlan0:
      dhcp4: yes
      dhcp6: no
      access-points:
        "ssid":
          password: "password"

netplan更多配置示例:https://netplan.io/examples

n1盒子的uboot u盘引导armbian/linux系统

发布时间:October 20, 2018 // 分类:N1 // No Comments

查看uboot的默认变量,保存在/dev/env设备中,armbian4.18内核不能识别此设备,3.14内核可以,查看默认启动命令为start_autoscript:

fw_printenv | grep bootcmd
bootcmd=run start_autoscript; run storeboot;

start_autoscript判断有usb刚执行start_usb_autoscript命令,mmc执行start_mmc_autoscript,具体如下:

start_autoscript=if usb start ; then run start_usb_autoscript; fi; run start_mmc_autoscript;
start_mmc_autoscript=if fatload mmc 0 1020000 s905_autoscript; then autoscr 1020000; fi;if fatload mmc 1 1020000 s905_autoscript; then autoscr 1020000; fi;
start_emmc_autoscript=if fatload mmc 1 1020000 emmc_autoscript; then autoscr 1020000; fi;
start_usb_autoscript=if fatload usb 0 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 1 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 2 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 3 1020000 s905_autoscript; then autoscr 1020000; fi;

start_usb_autoscript 加载usb设备1和2 fat分区根目录s905_autoscript文件并执行,s905_autoscript内容如下:

setenv env_addr    "0x10400000"
setenv kernel_addr "0x11000000"
setenv initrd_addr "0x13000000"
setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_mem_addr}
if fatload usb 0 ${kernel_addr} zImage; then if fatload usb 0 ${initrd_addr} uInitrd; then if fatload usb 0 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize};run cmdline_keys;fi; if fatload usb 0 ${dtb_mem_addr} dtb.img; then run boot_start; else store dtb read ${dtb_mem_addr}; run boot_start;fi;fi;fi;
if fatload usb 1 ${kernel_addr} zImage; then if fatload usb 1 ${initrd_addr} uInitrd; then if fatload usb 1 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize};run cmdline_keys;fi; if fatload usb 1 ${dtb_mem_addr} dtb.img; then run boot_start; else store dtb read ${dtb_mem_addr}; run boot_start;fi;fi;fi;
if fatload mmc 0 ${kernel_addr} zImage; then if fatload mmc 0 ${initrd_addr} uInitrd; then if fatload mmc 0 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize};run cmdline_keys;fi; if fatload mmc 0 ${dtb_mem_addr} dtb.img; then run boot_start; else store dtb read ${dtb_mem_addr}; run boot_start;fi;fi;fi;
if fatload mmc 1 ${kernel_addr} zImage; then if fatload mmc 1 ${initrd_addr} uInitrd; then if fatload mmc 1 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize};run cmdline_keys;fi; if fatload mmc 1 ${dtb_mem_addr} dtb.img; then run boot_start; else store dtb read ${dtb_mem_addr}; run boot_start;fi;fi;fi;

s905_autoscript加载所在分区zImage、uInitrd、dtb.img、uEnv.ini文件,并引导系统启动。

更改uboot变量方法如下:

fw_setenv start_autoscript "if usb start ; then run start_usb_autoscript; fi; if ext4load mmc 1:c 1020000 /boot/s905_autoscript; then autoscr 1020000; fi;"

对于s905_autoscript文件可用mkimage生成:

mkimage -C none -A arm -T script -d /boot/s905_autoscript.cmd /boot/s905_autoscript

为n1制作aarcm64/arm64 ubuntu rootfs系统

发布时间:October 20, 2018 // 分类:N1 // No Comments

安装debootstrap和qemu-user-static:

apt install apt-transport-https qemu qemu-user-static binfmt-support debootstrap

构建ubuntu 18.04系统,基础包为minbase,使用清大的源:

qemu-debootstrap --arch arm64 --variant=minbase --include=whiptail,ca-certificates,tzdata bionic rootfs http://mirrors.ustc.edu.cn/ubuntu-ports/

配置软件源:

cat > rootfs/etc/apt/sources.list <<EOF
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
EOF

配置网络信息:

mkdir rootfs/etc/network/ 
echo 'nameserver 192.168.168.1' > rootfs/etc/resolv.conf
echo 'ubuntu-18.04' > rootfs/etc/hostname
cat > rootfs/etc/netplan/50-cloud-init.yaml <<EOF
network:
    ethernets:
        eth0:
            addresses:
            - 192.168.168.6/24
            dhcp4: false
            gateway4: 192.168.168.1
            nameservers:
                addresses:
                - 192.168.168.1
                search: []
    version: 2
EOF

挂载本地设备文件到rootfs:

mount -t proc /proc  rootfs/proc 
mount -t sysfs /sys  rootfs/sys 
mount -o bind /dev  rootfs/dev 
mount -o bind /dev/pts  rootfs/dev/pts 

chroot rootfs内配置:

LANG=C.UTF-8 chroot rootfs/  /bin/bash

在rootfs内执行:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt update
apt upgrade
apt install systemd -y 
apt install wireless-regdb crda -y
apt install rsyslog udev dbus kmod openssh-server netplan.io man vim wget net-tools sysstat tmux less wireless-regdb crda dosfstools parted rng-tools -y
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
passwd root
umount /dev/pts/ /dev/ /proc/ /sys 
exit

为方便使用之前编译的内核和armbian的uInitrd、firmware文件,挂载armbian的img镜像到本地:

losetup -P -f --show Armbian_5.62_Aml-s9xxx_Ubuntu_bionic_default_4.18.7_20181012.img
mount /dev/loop3p2 /mnt
mount /dev/loop3p2 /mnt/boot
mv /mnt/boot/* rootfs/boot/
mv /mnt/lib/modules/ rootfs/lib/
#也可安装armbian的firmware-aml-4.18-20181011_5.62_arm64.deb
mv /mnt/lib/firmware/ rootfs/lib/
mv /mnt/etc/modprobe.d/ rootfs/etc/
mv /mnt/etc/fstab rootfs/etc/
mv /mnt/root/install.sh rootfs/root/

将armbain镜像内的文件全部删除,将新做的系统移动过去。

rm -rf /mnt/*
mv rootfs/boot/* /mnt/boot/
mv rootfs/* /mnt/

参考:
https://help.ubuntu.com/lts/installation-guide/s390x/apds04.html

n1下ubuntu安装cups配置airprint网络打印服务器

发布时间:October 20, 2018 // 分类:N1 // No Comments

打印机通过usb接口连接n1,ubuntu/armbian要安装usblp内核模块,查看本机是否有usblp模块:

modinfo usblp
filename:       /lib/modules/4.18.7-aml-s9xxx/kernel/drivers/usb/class/usblp.ko
license:        GPL
description:    USB Printer Device Class driver

如果没有需编译内核usblp模块,可参考:https://www.haiyun.me/archives/1266.html
系统软件源使用所有,不然很多打印机驱动没有:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

然后安装配置cpus

apt update
apt install cups

修改为以下配置:

#这行很重要,是否将共享的打印机让本地网络发现,如使用airprint。
Browsing on
Listen 0.0.0.0:631
<Location />
  Order allow,deny
  Allow all
</Location>

<Location /admin>
  Order allow,deny
  Allow all
</Location>

重启cups:

systemctl restart cups
systemctl restart cups-browsed

将打印机和n1连接,此时内核日志应该提示打印机已连接:

dmesg|tail -n 1
usblp 1-1:1.1: usblp0: USB Bidirectional printer dev 8 if 1 alt 0 proto 2 vid 0x04A9 pid 0x176C

cups有此打印机驱动也正常识别了:

lpinfo -v      
network ipp
direct usb://Canon/MG2400%20series?serial=988776&interface=1

查看支持的打印机驱动:

lpinfo -m

访问cups web管理界面添加打印机,地址:ip:631,配置很简单,详细步骤略过。
添加打印机后iphone应该就能通过airprint识别打印机了。
windows下可在控制面板下添加打印机,地址为ip:631/printers/name

无打印机驱动的可添加打印机为raw模式,windows下连接共享的打印机选择相应的驱动也可打印:

lpadmin -p mg2400 -E -v  parallel:/dev/usb/lp0 

遇到的一些问题:
1.开机启动时加载内核驱动失败,cups默认会加载lp/ppdev/parport_pc内核驱动,由于已使用usblp内核驱动,可将这些注释掉,/etc/modules-load.d/cups-filters.conf
2.通过cups打印时没反应,内核提示usblp0: removed,打印机未正常工作,可将打印机连接至电脑查看具体原因。

更多参考:
http://www.winotmk.com/2017/03/1136
https://www.ncnynl.com/archives/201608/742.html
https://ubuntuforums.org/showthread.php?t=2295559

n1盒子不能开机救砖

发布时间:October 17, 2018 // 分类:N1 // No Comments

将armbian写入N1 mmc分区的时候将分区搞坏了,启动时显示logo界面后一直黑屏,不能进入android系统和通过U盘启动,也就没办法进入线刷模式,准备拆机短接进入线刷模式,再不行上TTL线,偶然在恩山看到通过插拔电源接口线可进入线刷模式,试了下刷机成功,万幸。
1.打开刷机软件导入镜像,点击开始。
2.N1盒子端拔掉电源线,用双公头USB线连接电脑和盒子
3.插入电源线,不出意外开始刷机。

参考:
http://www.right.com.cn/forum/thread-336312-1-1.html
http://www.right.com.cn/forum/thread-335972-1-1.html

分类
最新文章
最近回复
  • 海运: 你是编译不成功呢?还是编译后不能运行呢?还是运行后不能访问web界面呢?
  • 白墨: 可能不清楚就是编译安装后启动后访问不了web界面
  • 白墨: 你好博主按照你的教程是编译安装不了的,在centos7版本下,我在开源镜像站下载centos7...
  • 感谢: 好的谢谢。
  • 海运: 可在github选择指定的branch或tag查看Makefile文件内核版本git指定bra...
  • 感谢: 请问一下“git checkout 20181012”这条命令是什么意思,没有google到。...
  • 海运: 抱歉,我没用蓝牙,现在N1在稳定挂PT中,没法折腾了。
  • hxhw: 大神能弄一個N1盒子開啟藍芽的教程不?我目前的藍芽識別不了似的(BD Address: 00:...
  • 海运: 抱歉,没用过wireguard,不了解具体情况。看错误提示是创建虚拟网卡的类型wireguar...
  • zhu tie: 本人小白我想在n1上装wireguard,安装后错误信息如下:wg-quick up wg0[...
页面执行耗时:0.0784秒。-->