unifreq / openwrt_packit

Flippy's openwrt packaged source code
1.37k stars 404 forks source link

整个打包只能在action里进行吗 #15

Closed zhangguanzhang closed 3 years ago

zhangguanzhang commented 3 years ago

我准备加打包,目前编译好的 rootfs 有了,但是打包想在本地尝试,但是看了下脚本里面貌似缺变量的声明和读取,我在容器里执行根的openwrt_flippy.sh报错下面的,看样子只能action 上打包吗

openwrt_flippy.sh: line 300: $GITHUB_ENV: ambiguous redirect
unifreq commented 3 years ago

这个脚本是在action里用的,本地打包要用mk开头的发自我的华为手机-------- 原始邮件 --------发件人: zhangguanzhang @.>日期: 2021年8月30日周一 21:29收件人: unifreq/openwrt_packit @.>抄送: Subscribed @.***>主 题: [unifreq/openwrt_packit] 整个打包只能在action里进行吗 (#15)

我准备加打包,目前编译好的 rootfs 有了,但是打包想在本地尝试,但是看了下脚本里面貌似缺变量的声明和读取,我在容器里执行根的openwrt_flippy.sh报错下面的,看样子只能action 上打包吗

openwrt_flippy.sh: line 300: $GITHUB_ENV: ambiguous redirect

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.

zhangguanzhang commented 3 years ago

我在特权容器里打包失败了

docker run -tid --name test \
    --device=/dev/loop-control:/dev/loop-control \
    --device=/dev/loop0:/dev/loop0 \
    --device=/dev/loop0p1:/dev/loop0p1 \
    --device=/dev/loop0p2:/dev/loop0p2 \
    -v $PWD/openwrt_packit:/opt/ --cap-add SYS_ADMIN ubuntu
root@7b7896f12347:/opt# ./mk_s905d_n1.sh 
========================= begin ./mk_s905d_n1.sh ===========================
Use /opt/openwrt-armvirt-64-default-rootfs.tar.gz as openwrt rootfs!
check mkfs.btrfs ok
check mkfs.vfat ok
check uuidgen ok
check losetup ok
check lsblk ok
check parted ok
/opt/tmp/tmp.sofeCAwDrX
创建空白的目标镜像文件 ...
900
900+0 records in
900+0 records out
943718400 bytes (944 MB, 900 MiB) copied, 1.18011 s, 800 MB/s
创建磁盘分区和文件系统 ...
Model: Loopback device (loopback)
Disk /dev/loop0: 944MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      4194kB  273MB  268MB  primary               lba
 2      273MB   944MB  671MB  primary

mkfs.fat 4.1 (2017-01-24)
mkfs.vfat: unable to open /dev/loop0p1: No such file or directory
ROOTFS_UUID = 14e40c44-0128-458b-b8b8-bf3147d19fcd
btrfs-progs v5.4.1 
See http://btrfs.wiki.kernel.org for more information.

probe of /dev/loop0p2 failed, cannot detect existing filesystem.
ERROR: use the -f option to force overwrite of /dev/loop0p2
挂载目标设备 ...
mount: /opt/tmp/tmp.sofeCAwDrX/tgt_boot: special device /dev/loop0p1 does not exist.
mount: /opt/tmp/tmp.sofeCAwDrX/tgt_root: special device /dev/loop0p2 does not exist.
创建 /etc 子卷 ...
ERROR: not a btrfs filesystem: /opt/tmp/tmp.sofeCAwDrX/tgt_root
openwrt 根文件系统解包 ... 
Armbian firmware 解包 ... 
内核模块解包 ... 
boot 文件解包 ... 
'/opt/files/bootfiles/amlogic/aml_autoscript' -> './aml_autoscript'
'/opt/files/bootfiles/amlogic/aml_autoscript.cmd' -> './aml_autoscript.cmd'
'/opt/files/bootfiles/amlogic/boot-emmc.cmd' -> './boot-emmc.cmd'
'/opt/files/bootfiles/amlogic/boot-emmc.ini' -> './boot-emmc.ini'
'/opt/files/bootfiles/amlogic/boot-emmc.scr' -> './boot-emmc.scr'
'/opt/files/bootfiles/amlogic/boot.bmp' -> './boot.bmp'
'/opt/files/bootfiles/amlogic/boot.cmd' -> './boot.cmd'
'/opt/files/bootfiles/amlogic/boot.ini' -> './boot.ini'
'/opt/files/bootfiles/amlogic/boot.scr' -> './boot.scr'
'/opt/files/bootfiles/amlogic/emmc_autoscript' -> './emmc_autoscript'
'/opt/files/bootfiles/amlogic/emmc_autoscript.cmd' -> './emmc_autoscript.cmd'
'/opt/files/bootfiles/amlogic/s905_autoscript' -> './s905_autoscript'
'/opt/files/bootfiles/amlogic/s905_autoscript.cmd' -> './s905_autoscript.cmd'
'/opt/files/bootfiles/amlogic/u-boot.sd' -> './u-boot.sd'
'/opt/files/bootfiles/amlogic/u-boot.usb' -> './u-boot.usb'
'/opt/files/bootfiles/amlogic/uEnv.txt' -> './uEnv.txt'
'vmlinuz-5.13.13-flippy-63+' -> 'zImage'
'uInitrd-5.13.13-flippy-63+' -> 'uInitrd'
'/opt/files/meson_btld/without_fip/u-boot-gtking.bin' -> './u-boot-gtking.bin'
'/opt/files/meson_btld/without_fip/u-boot-gtkingpro.bin' -> './u-boot-gtkingpro.bin'
'/opt/files/meson_btld/without_fip/u-boot-n1.bin' -> './u-boot-n1.bin'
'/opt/files/meson_btld/without_fip/u-boot-p201.bin' -> './u-boot-p201.bin'
'/opt/files/meson_btld/without_fip/u-boot-p212.bin' -> './u-boot-p212.bin'
'/opt/files/meson_btld/without_fip/u-boot-sei510.bin' -> './u-boot-sei510.bin'
'/opt/files/meson_btld/without_fip/u-boot-sei610.bin' -> './u-boot-sei610.bin'
'/opt/files/meson_btld/without_fip/u-boot-u200.bin' -> './u-boot-u200.bin'
'/opt/files/meson_btld/without_fip/u-boot-ugoos-x3.bin' -> './u-boot-ugoos-x3.bin'
'/opt/files/meson_btld/without_fip/u-boot-x96max.bin' -> './u-boot-x96max.bin'
'/opt/files/meson_btld/without_fip/u-boot-x96maxplus.bin' -> './u-boot-x96maxplus.bin'
'/opt/files/meson_btld/without_fip/u-boot-zyxq.bin' -> './u-boot-zyxq.bin'
NAME    PATH         UUID
loop0   /dev/loop0   
sda     /dev/sda     
sda1    /dev/sda1    
sr0     /dev/sr0     
loop0p1 /dev/loop0p1 
loop0p2 /dev/loop0p2 
BOOT_UUID is 
ROOTFS_UUID is 14e40c44-0128-458b-b8b8-bf3147d19fcd
修改引导分区相关配置 ... 
uEnv.txt --->
LINUX=/zImage
INITRD=/uInitrd

# 下列 dtb,用到哪个就把哪个的#删除,其它的则加上 # 在行首

# 用于 Phicomm N1
FDT=/dtb/amlogic/meson-gxl-s905d-phicomm-n1.dtb

# 用于 Phicomm N1 (thresh)
#FDT=/dtb/amlogic/meson-gxl-s905d-phicomm-n1-thresh.dtb

APPEND=root=UUID=14e40c44-0128-458b-b8b8-bf3147d19fcd rootfstype=btrfs rootflags=compress=zstd console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
'u-boot-n1.bin' -> 'u-boot.ext'
修改根文件系统相关配置 ... 
'/opt/files/jq' -> './usr/bin/jq'
'/opt/files/balethirq.pl' -> 'usr/sbin/balethirq.pl'
'/opt/files/s905d/balance_irq' -> 'etc/config/balance_irq'
'/opt/files/s905d/wireless' -> 'etc/config/wireless'
'/opt/files/fixcpufreq.pl' -> 'usr/sbin/fixcpufreq.pl'
patching file etc/init.d/sysfixtime
patching file etc/ssl/openssl.cnf
patching file etc/init.d/dockerd
'/opt/files/30-sysinfo.sh' -> './etc/profile.d/30-sysinfo.sh'
patching file etc/samba/smb.conf.template
/etc/fstab --->
UUID=14e40c44-0128-458b-b8b8-bf3147d19fcd / btrfs compress=zstd 0 1
LABEL=BOOT /boot vfat defaults 0 2
#tmpfs /tmp tmpfs defaults,nosuid 0 0
/etc/config/fstab --->
config global
        option anon_swap '0'
        option auto_swap '0'
        option anon_mount '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '0'

config mount
        option target '/overlay'
        option uuid '14e40c44-0128-458b-b8b8-bf3147d19fcd'
        option enabled '1'
        option enabled_fsck '1'
    option options 'compress=zstd'
    option fstype 'btrfs'

config mount
        option target '/boot'
        option label 'BOOT'
        option enabled '1'
        option enabled_fsck '1'
    option fstype 'vfat'
'/opt/files/DockerReadme.pdf' -> './www/DockerReadme.pdf'
5.13.13-flippy-63+
06:42:63:E9:A7:48
patching file usr/lib/lua/luci/view/admin_status/index.htm
patching file usr/lib/lua/luci/view/admin_status/index.htm
创建初始快照: /etc -> /.snapshots/etc-000
ERROR: Not a Btrfs filesystem: Invalid argument
umount: /opt/tmp/tmp.sofeCAwDrX/tgt_boot: not mounted.
umount: /opt/tmp/tmp.sofeCAwDrX/tgt_root: not mounted.

镜像打包已完成,再见!
========================== end ./mk_s905d_n1.sh ================================
zhangguanzhang commented 3 years ago

漏看了脚本第一行的加载变量了。刚在pve的机器上打包能成功了,不知道为啥在容器里不行。我把手动的步骤加到action里估计就行了

oldPATH=$(pwd)

sudo apt-get update && \
   sudo apt-get install -y   btrfs-progs dosfstools uuid-runtime parted gawk wget patch xz-utils

git clone --depth 1 https://github.com/unifreq/openwrt_packit /opt/openwrt_packit

mkdir -p /opt/kernel

cp bin/targets/*/*/openwrt-armvirt-64-default-rootfs.tar.gz /opt/openwrt_packit/

source /opt/openwrt_packit/make.env

export kernel_URL=https://raw.githubusercontent.com/breakings/OpenWrt/main/opt/kernel

export kernel_VER=${KERNEL_VERSION%%-*}
export KERNEL_VERSION=$KERNEL_VERSION
# KERNEL_VERSION="5.13.13-flippy-63+"
(
    cd /opt/kernel/
    wget ${kernel_URL}/${kernel_VER}/boot-${KERNEL_VERSION}.tar.gz
    wget ${kernel_URL}/${kernel_VER}/dtb-allwinner-${KERNEL_VERSION}.tar.gz
    wget ${kernel_URL}/${kernel_VER}/dtb-amlogic-${KERNEL_VERSION}.tar.gz
    wget ${kernel_URL}/${kernel_VER}/dtb-rockchip-${KERNEL_VERSION}.tar.gz
    wget ${kernel_URL}/${kernel_VER}/modules-${KERNEL_VERSION}.tar.gz
    cd /opt/openwrt_packit
    sudo ./mk_s905d_n1.sh 
)

mv bin/targets/*/*/config.buildinfo /opt/openwrt_packit/tmp/

rm -f bin/targets/*/*/*
mv /opt/openwrt_packit/tmp/* bin/targets/*/*/
ls -lh bin/targets/*/*/

感谢大屌的库,已经打包成功了

Connecting to 192.168.1.1:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\    ____                 _       __     __  /
\   / __ \____  ___  ____| |     / /____/ /_ /
\  / / / / __ \/ _ \/ __ \ | /| / / ___/ __/ /
\ / /_/ / /_/ /  __/ / / / |/ |/ / /  / /_   /
\ \____/ .___/\___/_/ /_/|__/|__/_/   \__/   /
\     /_/  W I R E L E S S   F R E E D O M   /
\                                            /
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Base on OpenWrt R21.8.6 by lean & lienol
 Kernel 5.13.13-flippy-63+
 Packaged by 活雷锋 on 2021-08-31
 SOC: s905d BOARD: n1

设备信息: Phicomm N1
CPU 型号:  AArch64 : Cortex-A53 x 4
系统负载:  0.17 0.24 0.13   运行时间:  5分钟 26秒      
环境温度:  46.0 °C              当前频率:  1512 Mhz
内存已用:  5% of 1935MB     IP  地址:  192.168.1.1
启动存储:  31% of 255.7M    系统存储:  54% of 640.0M    

root@OpenWrt:~# ls -l /root/
-rwxr-xr-x    1 root     root         15290 Aug 31 22:09 install-to-emmc.sh