====== アップデート用ファームウェアの作成(クロス) ====== "build_firm.sh" スクリプトにより、ファームウェアファイルを作ることができます。((root 権限での作業が必要です))\\ スクリプト本体は、[[download_software:mae3xx:start|ダウンロード:MA-E3xxシリーズ]] にあります。 root@lubuntu-vpc:/home/user1# ./build_firm.sh MA-E3xx series Firmware build script usage: build_firm.sh -k kernel_dir -r rootfs dir [-o firmware_file] 引数として、下記を指定します。 * **-k** : カーネルソースを展開したディレクトリ * **-r** : root filesystemのアーカイブ(([[download_software:mae3xx:start]] からダウンロードできます))を展開((root 権限での作業が必要です))したディレクトリ * -o : 出力ファームウェアファイル名 (省略可: 省略時、カレントディレクトリに "firmware_YYYYMMDD_hhmmss.img" 形式で作成します) \\ 実行サンプルを示します。 root@lubuntu-vpc:/home/user1# ./build_firm.sh -k src/linux-kernel -r work/rootfs MA-E3xx series Firmware build script * kernelrelease: 3.14.0-rc7+ CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' は更新済みです CALL scripts/checksyscalls.sh CHK include/generated/compile.h SKIPPED include/generated/compile.h CHK kernel/config_data.h Kernel: arch/arm/boot/Image is ready Building modules, stage 2. Kernel: arch/arm/boot/zImage is ready MODPOST 178 modules CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' は更新済みです CALL scripts/checksyscalls.sh CHK include/generated/compile.h SKIPPED include/generated/compile.h CHK kernel/config_data.h Kernel: arch/arm/boot/Image is ready Kernel: arch/arm/boot/zImage is ready Image arch/arm/boot/uImage is ready * copying kernel image * copying DeviceTree blob * instal kernel modules to /home/user1/work/rootfs/lib/modules/3.14.0-rc7+ INSTALL drivers/crypto/omap-aes.ko INSTALL drivers/crypto/omap-sham.ko INSTALL drivers/misc/ti-st/st_drv.ko INSTALL drivers/mtd/chips/map_ram.ko INSTALL drivers/mtd/devices/block2mtd.ko INSTALL drivers/mtd/devices/m25p80.ko INSTALL drivers/mtd/devices/mtdram.ko INSTALL drivers/mtd/maps/plat-ram.ko INSTALL drivers/mtd/nand/nandsim.ko INSTALL drivers/net/usb/asix.ko INSTALL drivers/net/usb/ax88179_178a.ko INSTALL drivers/net/usb/cdc_eem.ko INSTALL drivers/net/usb/cdc_ether.ko INSTALL drivers/net/usb/cdc_mbim.ko INSTALL drivers/net/usb/cdc_ncm.ko INSTALL drivers/rtc/rtc-omap.ko INSTALL drivers/thermal/ti-soc-thermal/ti-soc-thermal.ko INSTALL drivers/usb/class/cdc-wdm.ko INSTALL lib/ts_bm.ko INSTALL lib/ts_fsm.ko INSTALL lib/ts_kmp.ko INSTALL net/bridge/netfilter/ebt_802_3.ko INSTALL net/bridge/netfilter/ebt_among.ko INSTALL net/bridge/netfilter/ebt_arp.ko INSTALL net/bridge/netfilter/ebt_arpreply.ko INSTALL net/bridge/netfilter/ebt_dnat.ko INSTALL net/bridge/netfilter/ebt_ip.ko INSTALL net/bridge/netfilter/ebt_ip6.ko INSTALL net/bridge/netfilter/ebt_limit.ko INSTALL net/bridge/netfilter/ebt_log.ko INSTALL net/bridge/netfilter/ebt_mark.ko INSTALL net/bridge/netfilter/ebt_mark_m.ko INSTALL net/bridge/netfilter/ebt_nflog.ko INSTALL net/bridge/netfilter/ebt_pkttype.ko INSTALL net/bridge/netfilter/ebt_redirect.ko INSTALL net/bridge/netfilter/ebt_snat.ko INSTALL net/bridge/netfilter/ebt_stp.ko INSTALL net/bridge/netfilter/ebt_ulog.ko INSTALL net/bridge/netfilter/ebt_vlan.ko INSTALL net/bridge/netfilter/ebtable_filter.ko INSTALL net/bridge/netfilter/ebtable_nat.ko INSTALL net/bridge/netfilter/nf_tables_bridge.ko INSTALL net/ipv4/netfilter/arp_tables.ko INSTALL net/ipv4/netfilter/arpt_mangle.ko INSTALL net/ipv4/netfilter/arptable_filter.ko INSTALL net/ipv4/netfilter/ipt_CLUSTERIP.ko INSTALL net/ipv4/netfilter/ipt_ECN.ko INSTALL net/ipv4/netfilter/ipt_ah.ko INSTALL net/ipv4/netfilter/ipt_rpfilter.ko INSTALL net/ipv4/netfilter/iptable_raw.ko INSTALL net/ipv4/netfilter/nf_nat_snmp_basic.ko INSTALL net/ipv4/netfilter/nf_tables_arp.ko INSTALL net/ipv4/netfilter/nf_tables_ipv4.ko INSTALL net/ipv4/netfilter/nft_chain_nat_ipv4.ko INSTALL net/ipv4/netfilter/nft_chain_route_ipv4.ko INSTALL net/ipv4/netfilter/nft_reject_ipv4.ko INSTALL net/ipv6/ah6.ko INSTALL net/ipv6/esp6.ko INSTALL net/ipv6/ip6_gre.ko INSTALL net/ipv6/ip6_tunnel.ko INSTALL net/ipv6/ipcomp6.ko INSTALL net/ipv6/netfilter/ip6_tables.ko INSTALL net/ipv6/netfilter/ip6t_MASQUERADE.ko INSTALL net/ipv6/netfilter/ip6t_NPT.ko INSTALL net/ipv6/netfilter/ip6t_REJECT.ko INSTALL net/ipv6/netfilter/ip6t_SYNPROXY.ko INSTALL net/ipv6/netfilter/ip6t_ah.ko INSTALL net/ipv6/netfilter/ip6t_eui64.ko INSTALL net/ipv6/netfilter/ip6t_frag.ko INSTALL net/ipv6/netfilter/ip6t_hbh.ko INSTALL net/ipv6/netfilter/ip6t_ipv6header.ko INSTALL net/ipv6/netfilter/ip6t_mh.ko INSTALL net/ipv6/netfilter/ip6t_rpfilter.ko INSTALL net/ipv6/netfilter/ip6t_rt.ko INSTALL net/ipv6/netfilter/ip6table_filter.ko INSTALL net/ipv6/netfilter/ip6table_mangle.ko INSTALL net/ipv6/netfilter/ip6table_nat.ko INSTALL net/ipv6/netfilter/ip6table_raw.ko INSTALL net/ipv6/netfilter/nf_conntrack_ipv6.ko INSTALL net/ipv6/netfilter/nf_defrag_ipv6.ko INSTALL net/ipv6/netfilter/nf_nat_ipv6.ko INSTALL net/ipv6/netfilter/nf_tables_ipv6.ko INSTALL net/ipv6/netfilter/nft_chain_nat_ipv6.ko INSTALL net/ipv6/netfilter/nft_chain_route_ipv6.ko INSTALL net/ipv6/netfilter/nft_reject_ipv6.ko INSTALL net/ipv6/sit.ko INSTALL net/ipv6/tunnel6.ko INSTALL net/ipv6/xfrm6_mode_beet.ko INSTALL net/ipv6/xfrm6_mode_ro.ko INSTALL net/ipv6/xfrm6_mode_transport.ko INSTALL net/ipv6/xfrm6_mode_tunnel.ko INSTALL net/ipv6/xfrm6_tunnel.ko INSTALL net/netfilter/ipset/ip_set_bitmap_ip.ko INSTALL net/netfilter/ipset/ip_set_bitmap_ipmac.ko INSTALL net/netfilter/ipset/ip_set_bitmap_port.ko INSTALL net/netfilter/ipset/ip_set_hash_ip.ko INSTALL net/netfilter/ipset/ip_set_hash_ipport.ko INSTALL net/netfilter/ipset/ip_set_hash_ipportip.ko INSTALL net/netfilter/ipset/ip_set_hash_ipportnet.ko INSTALL net/netfilter/ipset/ip_set_hash_net.ko INSTALL net/netfilter/ipset/ip_set_hash_netiface.ko INSTALL net/netfilter/ipset/ip_set_hash_netnet.ko INSTALL net/netfilter/ipset/ip_set_hash_netport.ko INSTALL net/netfilter/ipset/ip_set_hash_netportnet.ko INSTALL net/netfilter/ipset/ip_set_list_set.ko INSTALL net/netfilter/nf_tables.ko INSTALL net/netfilter/nf_tables_inet.ko INSTALL net/netfilter/nft_compat.ko INSTALL net/netfilter/nft_counter.ko INSTALL net/netfilter/nft_ct.ko INSTALL net/netfilter/nft_exthdr.ko INSTALL net/netfilter/nft_hash.ko INSTALL net/netfilter/nft_limit.ko INSTALL net/netfilter/nft_log.ko INSTALL net/netfilter/nft_meta.ko INSTALL net/netfilter/nft_nat.ko INSTALL net/netfilter/nft_queue.ko INSTALL net/netfilter/nft_rbtree.ko INSTALL net/netfilter/nft_reject.ko INSTALL net/netfilter/nft_reject_inet.ko INSTALL net/netfilter/xt_CHECKSUM.ko INSTALL net/netfilter/xt_CLASSIFY.ko INSTALL net/netfilter/xt_CT.ko INSTALL net/netfilter/xt_DSCP.ko INSTALL net/netfilter/xt_HL.ko INSTALL net/netfilter/xt_HMARK.ko INSTALL net/netfilter/xt_IDLETIMER.ko INSTALL net/netfilter/xt_NETMAP.ko INSTALL net/netfilter/xt_NFLOG.ko INSTALL net/netfilter/xt_NFQUEUE.ko INSTALL net/netfilter/xt_RATEEST.ko INSTALL net/netfilter/xt_TCPMSS.ko INSTALL net/netfilter/xt_TCPOPTSTRIP.ko INSTALL net/netfilter/xt_TEE.ko INSTALL net/netfilter/xt_TPROXY.ko INSTALL net/netfilter/xt_TRACE.ko INSTALL net/netfilter/xt_addrtype.ko INSTALL net/netfilter/xt_bpf.ko INSTALL net/netfilter/xt_cgroup.ko INSTALL net/netfilter/xt_cluster.ko INSTALL net/netfilter/xt_comment.ko INSTALL net/netfilter/xt_connbytes.ko INSTALL net/netfilter/xt_connlabel.ko INSTALL net/netfilter/xt_connlimit.ko INSTALL net/netfilter/xt_conntrack.ko INSTALL net/netfilter/xt_cpu.ko INSTALL net/netfilter/xt_dccp.ko INSTALL net/netfilter/xt_devgroup.ko INSTALL net/netfilter/xt_dscp.ko INSTALL net/netfilter/xt_ecn.ko INSTALL net/netfilter/xt_esp.ko INSTALL net/netfilter/xt_hashlimit.ko INSTALL net/netfilter/xt_helper.ko INSTALL net/netfilter/xt_hl.ko INSTALL net/netfilter/xt_iprange.ko INSTALL net/netfilter/xt_length.ko INSTALL net/netfilter/xt_limit.ko INSTALL net/netfilter/xt_mac.ko INSTALL net/netfilter/xt_multiport.ko INSTALL net/netfilter/xt_nfacct.ko INSTALL net/netfilter/xt_osf.ko INSTALL net/netfilter/xt_owner.ko INSTALL net/netfilter/xt_physdev.ko INSTALL net/netfilter/xt_pkttype.ko INSTALL net/netfilter/xt_policy.ko INSTALL net/netfilter/xt_quota.ko INSTALL net/netfilter/xt_rateest.ko INSTALL net/netfilter/xt_realm.ko INSTALL net/netfilter/xt_recent.ko INSTALL net/netfilter/xt_sctp.ko INSTALL net/netfilter/xt_set.ko INSTALL net/netfilter/xt_socket.ko INSTALL net/netfilter/xt_state.ko INSTALL net/netfilter/xt_statistic.ko INSTALL net/netfilter/xt_string.ko INSTALL net/netfilter/xt_tcpmss.ko INSTALL net/netfilter/xt_time.ko INSTALL net/netfilter/xt_u32.ko DEPMOD 3.14.0-rc7+ 合計 120 lrwxrwxrwx 1 root root 28 3月 19 10:19 build -> /home/user1/src/linux-kernel drwxr-xr-x 5 root root 4096 3月 19 10:19 kernel -rw-r--r-- 1 root root 13800 3月 19 10:19 modules.alias -rw-r--r-- 1 root root 20113 3月 19 10:19 modules.alias.bin -rw-r--r-- 1 root root 11658 3月 19 10:19 modules.builtin -rw-r--r-- 1 root root 14344 3月 19 10:19 modules.builtin.bin -rw-r--r-- 1 root root 8612 3月 19 10:19 modules.dep -rw-r--r-- 1 root root 15376 3月 19 10:19 modules.dep.bin -rw-r--r-- 1 root root 52 3月 19 10:19 modules.devname -rw-r--r-- 1 root root 6680 3月 19 10:19 modules.order -rw-r--r-- 1 root root 131 3月 19 10:19 modules.softdep -rw-r--r-- 1 root root 2764 3月 19 10:19 modules.symbols -rw-r--r-- 1 root root 3735 3月 19 10:19 modules.symbols.bin lrwxrwxrwx 1 root root 28 3月 19 10:19 source -> /home/user1/src/linux-kernel Parallel mksquashfs: Using 4 processors Creating 4.0 filesystem on /home/user1/build_1395191930/kmod.img, block size 131072. [=============================================================================================|] 189/189 100% Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072 compressed data, compressed metadata, compressed fragments, compressed xattrs duplicates are removed Filesystem size 422.11 Kbytes (0.41 Mbytes) 22.28% of uncompressed filesystem size (1894.33 Kbytes) Inode table size 1506 bytes (1.47 Kbytes) 21.68% of uncompressed inode table size (6946 bytes) Directory table size 2074 bytes (2.03 Kbytes) 43.61% of uncompressed directory table size (4756 bytes) Number of duplicate files found 0 Number of inodes 217 Number of files 189 Number of fragments 17 Number of symbolic links 0 Number of device nodes 0 Number of fifo nodes 0 Number of socket nodes 0 Number of directories 28 Number of ids (unique uids + gids) 1 Number of uids 1 root (0) Number of gids 1 root (0) Parallel mksquashfs: Using 4 processors Creating 4.0 filesystem on /home/user1/build_1395191930/rootfs.img, block size 1048576. [=========================================================================================-] 13028/13028 100% Exportable Squashfs 4.0 filesystem, xz compressed, data block size 1048576 compressed data, compressed metadata, compressed fragments, compressed xattrs duplicates are removed Filesystem size 54833.49 Kbytes (53.55 Mbytes) 25.27% of uncompressed filesystem size (217001.19 Kbytes) Inode table size 160688 bytes (156.92 Kbytes) 24.11% of uncompressed inode table size (666530 bytes) Directory table size 156848 bytes (153.17 Kbytes) 41.79% of uncompressed directory table size (375353 bytes) Number of duplicate files found 477 Number of inodes 18471 Number of files 13019 Number of fragments 139 Number of symbolic links 4034 Number of device nodes 0 Number of fifo nodes 0 Number of socket nodes 0 Number of directories 1418 Number of ids (unique uids + gids) 18 Number of uids 8 root (0) kikuchi (1000) libuuid (100) dnsmasq (104) syslog (101) ntp (105) www-data (33) usbmux (103) Number of gids 16 root (0) dip (30) shadow (42) kikuchi (1000) users (100) netdev (102) mail (8) utmp (43) syslog (104) tty (5) staff (50) libuuid (101) fuse (105) nogroup (65534) ssl-cert (107) adm (4) * create initramfs ... update-initramfs: Generating /boot/initrd.img-3.14.0-rc7+ /bin/df: Warning: cannot read table of mounted file systems: No such file or directory warning: failed to read mtab adding: kernel.img (stored 0%) adding: kmod.img (stored 0%) adding: initramfs.img (stored 0%) adding: rootfs.img (stored 0%) adding: dtb.img (deflated 78%) * Firmware filename: /home/user1/firmware_20140319_102118.img done. please remove working directory '/home/user1/build_1395191930' manually. root@lubuntu-vpc:/home/user1# \\ できあがったファームウェアファイルは以下のとおりです。 root@lubuntu-vpc:/home/user1# ls -l /home/user1/firmware_20140319_102118.img -rw-r--r-- 1 root root 61781549 3月 19 10:21 /home/user1/firmware_20140319_102118.img \\ ファームウェアファイルはZIPアーカイブ形式となっています。\\ 内容は下記のとおりとなっています。 root@lubuntu-vpc:/home/user1# unzip -v firmware_20140319_102118.img Archive: firmware_20140319_102118.img Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 3431840 Stored 3431840 0% 2014-03-19 10:19 d27c200d kernel.img 434176 Stored 434176 0% 2014-03-19 10:19 2b8250dd kmod.img 1754748 Stored 1754748 0% 2014-03-19 10:21 481c2b99 initramfs.img 56152064 Stored 56152064 0% 2014-03-19 10:20 4f4a0761 rootfs.img 36000 Defl:N 7963 78% 2014-03-19 10:19 336cb54e dtb.img -------- ------- --- ------- 61808828 61780791 0% 5 files root@lubuntu-vpc:/home/user1# \\ ===== カスタマイズ ===== ==== カーネルコンフィグのカスタマイズ ==== カーネルソースのディレクトリに ".config" ファイルがない場合、デフォルトのコンフィグを使用します。\\ 組み込むドライバを変更するなどのカスタマイズは、"build_firm" スクリプト実行前に "make menuconfig" などで\\ 実行しておいてください。 {{:mae3xx_devel:build_firmware:make_menuconfig.png|make menuconfig}} \\ ==== ファイルシステムのカスタマイズ ==== ターゲット用ファイルシステムのカスタマイズ (パッケージ追加など) を行い、ファームウェアにすることも可能です。\\ [[mae3xx_devel:chroot_qemu:start]] を参照してください。 \\ ===== TIPS ===== ==== ファームウェア容量の削減 ==== v2.5.0 あたりから、Python 起動高速化のため、module のキャッシュをファームウェアに含めています (__pycache__ ディレクトリ)。\\ これが原因で追加パッケージ類が容量オーバーで入らなくなった場合、キャッシュを削除することで4MB程度容量を稼ぐことが可能です。 # find mae320_trusty_rootfs/usr -name __pycache__ mae320_trusty_rootfs/usr/lib/python3.4/urllib/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/ctypes/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/email/mime/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/email/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/wsgiref/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/plat-arm-linux-gnueabihf/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/concurrent/futures/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/concurrent/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/idlelib/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/unittest/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/curses/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/multiprocessing/dummy/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/multiprocessing/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/pydoc_data/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/json/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xmlrpc/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/logging/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xml/parsers/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xml/etree/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xml/dom/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xml/sax/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/xml/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/encodings/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/dbm/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/importlib/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/sqlite3/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/test/support/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/test/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/lib2to3/fixes/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/lib2to3/pgen2/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/lib2to3/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/tkinter/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/http/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/collections/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/venv/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/asyncio/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/html/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/distutils/command/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/distutils/__pycache__ mae320_trusty_rootfs/usr/lib/python3.4/__pycache__ \\ __pycache__ ディレクトリ以下を削除します。 # find mae320_trusty_rootfs/usr -name __pycache__ | xargs rm -rf \\ 削除前・後での rootfs.img の容量は下記のようになります。 * 削除前 63057920 2016-10-03 10:20 rootfs.img * 削除後 59187200 2016-10-04 09:45 rootfs.img