Linux: dovecot 2.4 アップデート

Debian trixieにアップデートしたときにdovecotも2.4.1にアップグレードされたのですが、設定が2.3から大幅にかわり、そのままでは動かないので再設定が必要になりました。その時の設定メモです。

旧設定はこちら

Dovecot

# 2.4.1-4 (7d8c0e5759): /etc/dovecot/dovecot.conf
# Pigeonhole version 2.4.1-4 (0a86619f)
# OS: Linux 6.12.57+deb13-amd64 i686 Debian 13.2 overlay
# Hostname: debian-mailserver
# 4 default setting changes since version 2.4.0
dovecot_config_version = 2.4.0
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = yes
dovecot_storage_version = 2.4.0
listen = *, ::
log_debug = category=mail
mail_driver = maildir
mail_home = /var/vmail/${user|domain}/${user|username}
mail_inbox_path = /var/vmail/${user|domain}/${user|username}
mail_path = /var/vmail
protocols = imap lmtp
ssl = required
ssl_cipher_list = kEECDH:+kEECDH+SHA:kEDH:+kEDH+SHA:+kEDH+CAMELLIA:kECDH:+kECDH+SHA:kRSA:+kRSA+SHA:+kRSA+CAMELLIA:!aNULL:!eNULL:!SSLv2:!RC4:!MD5:!DES:!EXP:!SEED:!IDEA:!3DES
passdb passwd-file {
  default_password_scheme = SHA512-CRYPT
  passwd_file_path = /etc/dovecot/imap.passwd
}
userdb static {
  fields {
    gid:default = vmail
    home:default = /var/vmail/${user|domain}/${user|username}
    uid:default = vmail
  }
}
namespace inbox {
  inbox = yes
}
service imap-login {
  inet_listener imap {
    port = 0
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    mode = 0600
    user = postfix 
    group = postfix
  }
}
service imap {
}
service auth {
  user = $SET:default_internal_user
  unix_listener /var/spool/postfix/private/auth {
    mode = 0600
    user = postfix 
    group = postfix
  }
}
service auth-worker {
  user = $SET:default_internal_user
}
service dict {
  unix_listener dict {
  }
}
ssl_server {
  cert_file = /etc/acme/hottunalabs.net/fullchain.cer
  dh_file = /etc/acme/ssl-dhparams.pem
  key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
}
local_name hottunalabs.net {
  ssl_server {
    cert_file = /etc/acme/hottunalabs.net/fullchain.cer
    key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
  }
}
local_name hottunalabs.mydns.org {
  ssl_server {
    cert_file = /etc/acme/hottunalabs.net/fullchain.cer
    key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
  }
dovecot_config_version = 2.4.0
dovecot_storage_version = 2.4.0
protocols = imap lmtp
!include_try /usr/share/dovecot/protocols.d/*.protocol
listen = *, ::
!include conf.d/*.conf
!include_try local.conf
auth_mechanisms = plain login 
!include auth-passwdfile.conf.ext
mail_driver = maildir
mail_path = /var/vmail
mail_home = /var/vmail/${user|domain}/${user|username}
mail_inbox_path = /var/vmail/${user|domain}/${user|username}
namespace inbox {
  inbox = yes
}
protocol !indexer-worker {
}
service imap-login {
  inet_listener imap {
    port = 0
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {   
    mode = 0600
    user = postfix 
    group = postfix
  }
}
service imap {
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0600
    user = postfix 
    group = postfix
  }
  user = $SET:default_internal_user
}
service auth-worker {
  user = $SET:default_internal_user
}
service dict {
  unix_listener dict {
  }
}
ssl = required
ssl_server_cert_file = /etc/acme/hottunalabs.net/fullchain.cer
ssl_server_key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
ssl_server_dh_file = /etc/acme/ssl-dhparams.pem
local_name hottunalabs.net {
    ssl_server_cert_file = /etc/acme/hottunalabs.net/fullchain.cer
    ssl_server_key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
}
local_name hottuna.server-on.net {
    ssl_server_cert_file = /etc/acme/hottunalabs.net/fullchain.cer
    ssl_server_key_file = /etc/acme/hottunalabs.net/hottunalabs.net.key
}
ssl_min_protocol = TLSv1.2
ssl_cipher_list = kEECDH:+kEECDH+SHA:kEDH:+kEDH+SHA:+kEDH+CAMELLIA:kECDH:+kECDH+SHA:kRSA:+kRSA+SHA:+kRSA+CAMELLIA:!aNULL:!eNULL:!SSLv2:!RC4:!MD5:!DES:!EXP:!SEED:!IDEA:!3DES
protocol lda {
}
protocol imap {
}
protocol lmtp {
}
passdb passwd-file {
  default_password_scheme = SHA512-CRYPT
  passwd_file_path = /etc/dovecot/imap.passwd
}
userdb static {
  fields {
    uid:default = vmail
    gid:default = vmail
    home:default = /var/vmail/${user|domain}/${user|username}
  }
}

opendkim

旧版ではinet socketでしたが今回はunix domain socketに変更します。

Syslog			yes
SyslogSuccess		yes
Canonicalization	relaxed/simple
OversignHeaders		From
Domain			hottunalabs.net
Selector                myselector
KeyFile			/etc/dkimkeys/myselector.private
UserID			opendkim
UMask			002
Socket			local:/var/spool/postfix/opendkim/opendkim.sock
PidFile			/run/opendkim/opendkim.pid
TrustAnchorFile		/usr/share/dns/root.key
sudo mkdir /etc/dkimkeys
sudo chown root: /etc/dkimkeys
sudo chmod 700 /etc/dkimkeys
cd /etc/dkimkeys 
sudo opendkim-genkey -r -s myselector -d <my domain name>
groupadd dkimsocket
usermod --append --groups dkimsocket postfix
usermod --gid dkimsocket opendkim
usermod --append --groups opendkim opendkim
usermod --append --groups opendkim postfix

myselector.txtができるのその内容をDNSサーバーに設定します。

myselector._domainkey   IN	 TXT	"v=DKIM1; p=...................."

openDMARC

PidFile /run/opendmarc/opendmarc.pid
PublicSuffixList /usr/share/publicsuffix/public_suffix_list.dat
Socket local:/var/spool/postfix/opendmarc/opendmarc.sock
Syslog true
UMask 0002
UserID opendmarc
sudo mkdir -p /var/spool/postfix/opendmarc
sudo chown opendmarc:opendmarc /var/spool/postfix/opendmarc -R
sudo chmod 750 /var/spool/postfix/opendmarc/ -R
sudo adduser postfix opendmarc

Postfix

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
compatibility_level = 3.6
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
inet_interfaces = all
inet_protocols = ipv4
message_size_limit = 10485760
setgid_group = postdrop
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
myhostname = mx.hottunalabs.net
mydomain = hottunalabs.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, mail-debian, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8, 10.0.0.0/24
mailbox_size_limit = 0
recipient_delimiter = +
local_recipient_maps = unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
smtp_sender_dependent_authentication = yes
smtpd_tls_chain_files = /etc/acme/hottunalabs.net/hottunalabs.net.key, /etc/acme/hottunalabs.net/fullchain.cer
tls_server_sni_maps = hash:/etc/postfix/ssl_map
smtpd_tls_security_level=may
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
cyrus_sasl_config_path = /etc/postfix/sasl
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_tls_auth_only = yes
smtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender, hash:/etc/postfix/reject_sender
smtpd_recipient_restrictions = permit_sasl_authenticated,
        permit_mynetworks,
        reject_unauth_destination,
        reject_invalid_hostname,
        reject_unknown_recipient_domain,
        reject_unauth_destination,
smtpd_helo_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname,
        reject_unknown_helo_hostname
recipient_delimiter = +
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = $mydomain
virtual_alias_domains = hottunalabs.mydns.org
virtual_alias_maps = hash:/etc/postfix/virtual_aliases
milter_default_action = accept
milter_protocol       = 6
smtpd_milters         = local:opendkim/opendkim.sock,local:opendmarc/opendmarc.sock
non_smtpd_milters     = $smtpd_milters
smtp      inet  n       -       y       -       -       smtpd
submission inet n       -       y       -       -       smtpd
  -o smtpd_sasl_auth_enable=yes
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
        -o syslog_name=postfix/$service_name
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd
maildrop  unix  -       n       n       -       -       pipe
  flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
hottunalabs.net /etc/acme/hottunalabs.net/hottunalabs.net.key /etc/acme/hottunalabs.net/fullchain.cer
hottuna.server-on.net /etc/acme/hottunalabs.net/hottunalabs.net.key /etc/acme/hottunalabs.net/fullchain.cer
postmaster          root 
webmaster           root
 # Person who should get root's mail 
root                myname
info@hottunalabs.net     myname
myname@mydns.org	myname\@hottunalabs.net
myname@hottunalabs.net		myname\@hottunalabs.net
sudo touch reject_sender
sudo postmap reject_sender
sudo postmap ssl_map
sudo postmap virtual_aliases

参考

  • https://doc.dovecot.org/main/installation/upgrade/2.3-to-2.4.html
  • https://z-issue.com/wp/dovecot-2-3-to-2-4-update-problems/
  • https://wiki.archlinux.org/title/OpenDKIM
  • https://wiki.gentoo.org/wiki/OpenDKIM
Posted in Linux, Mail | Comments Off on Linux: dovecot 2.4 アップデート

Linux: Debian trixieのOpenRC化

VPSのDebianをbookwormからtrixieにアップグレードのついでにOpenRCも同時にすることにしました。方法はDebianのwikiを参照してそのとおりにしたのですが、結果はシステムが完全に破綻状態になりました。やはり無謀すぎたようです。それでクリーンインストールしてOpenRC化することにしました。OpenRC化する理由はsystemdはリソースを食いすぎて運用しているVPSにかなり負担になっているからです。

VPSに正規方法ではないインストール方法は手間がかかるのですが不要なパッケージ入れないようにするためにこの方法を使います。

やり方はまずVPSで用意されているCDを使ってブートし、レスキューモードのシェルを立ち上げます。そしてrootパーティションをchrootでマウントし、debootstrapコマンドでOSをインストールします。OSが復旧したら別途保存しておいた設定やデータをリストアします。

OpenRC化

initを置き換えるのはかなりトリッキーですが、Debianのwikiに方法があったのでその通りにやってみました。

apt –purge –allow-remove-essential install sysvinit-core libpam-elogind dbus-x11 systemd-sysv-

これはsysv-initなのでOpenRCの場合は次のようにします。

apt --purge --allow-remove-essential install openrc systemd-sysv-

OS復旧仕立て場合は一発で変更できました。経験としてパッケージを入れすぎると破綻してしまうということでした。そしてsystemdをインストールしないように予防線を張っておきます。

apt-mark hold systemd systemd-sysv

たいていのデーモンは/etc/init.dから起動できますがshorewallだけは起動できなかったので/etc/rc.localから起動するようにしました。

暗号化rootfsのネット経由のunlock

まずは必要なパッケージをインストールします。

apt install dropbear-initramfs

Client側でdropbear用のrsa鍵を作りid_rsa.pubをscp等でサーバに転送します。それを/etc/dropbear/initramfs/authorized_keysに書き込みます。次にinitramfs起動時に固定IPを設定します。

dropbearの設定を特にしなければsshポート22をを使いますが、設定した方が良いので変更します。

DROPBEAR_OPTIONS="-p 1234 -s -j -k -I 90"

各パラメータはmanpageを参照してください。

IP=192.168.1.128::192.168.1.1:255.255.255.0:vps-ablenet

シンタックスはip=<server-ip>::<gw-ip>:<netmask>:<hostname>です。

設定が完了したらinitramfsをアップデートします。

update-initramfs -u

リブートしてクライアント側からリモートログインしてrootfsをアンロックします。

ssh -p 1234 -o "UserKnownHostsFile=~/.ssh/known_hosts.ablenet" \
  -i "~/.ssh/id_rsa.ablenet_boot" root@192.168.1.128 \
 "echo -ne \"password_for_dm_crypt\" >/lib/cryptsetup/passfifo"

wireguard

google AIに尋ねてみると次のような回答でした。

https://www.google.com/search?q=wireguird+openrc+dsevuan&sca_esv=1fc1f57c86215af9&sxsrf=AE3TifNz7spmj-urtJ6wYPe7HeIimjQEeg%3A1767220613476&ei=haVVae3sHJ6k2roPqYuf8QY&ved=0ahUKEwitw5_n8eiRAxUeklYBHanFJ24Q4dUDCBM&uact=5&oq=wireguird+openrc+dsevuan&gs_lp=Egxnd3Mtd2l6LXNlcnAiGHdpcmVndWlyZCBvcGVucmMgZHNldnVhbjIHECEYoAEYCjIHECEYoAEYCjIHECEYoAEYCkjIGVDmBliJF3ABeACQAQGYAZICoAGbDKoBBTAuOC4xuAEDyAEA-AEBmAIIoALOCcICChAAGLADGNYEGEfCAgYQABgNGB7CAggQABgIGA0YHsICCxAAGIAEGIYDGIoFwgIFEAAY7wWYAwDiAwUSATEgQIgGAZAGCJIHBTEuNi4xoAfNJbIHBTAuNi4xuAfECcIHCTAuNS4yLjUtMcgHW4AIAA&sclient=gws-wiz-serp

#!/sbin/openrc-run
description="WireGuard Quick"
# Change 'wg0' to the name of your configuration file if different
name="wg0" 

depend() {
    need localmount
    need net
    # Might also need an explicit dependency on the physical interface if complex networking
}

start() {
    ebegin "Starting WireGuard interface ${name}"
    wg-quick up ${name}
    eend $?
}

stop() {
    ebegin "Stopping WireGuard interface ${name}"
    wg-quick down ${name}
    eend $?
}

dependファンクションのlocalmountとnetがdebianでは起動してないのでそのままだとエラーで起動できません。それなのでdbusならシステムの要であり割と遅く起動するので変更しました。

#!/sbin/openrc-run
description="WireGuard Quick"
# Change 'wg0' to the name of your configuration file if different
name="wg0"

depend() {
    #need localmount
    #need net
    need dbus
    # Might also need an explicit dependency on the physical interface if complex networking
}

start() {
    ebegin "Starting WireGuard interface ${name}"
    wg-quick up ${name}
    eend $?
}

stop() {
    ebegin "Stopping WireGuard interface ${name}"
    wg-quick down ${name}
    eend $?
}
cd /etc/init.d
ln -s wg-quick wg-quick@wg0
rc-update add wg-quick@wg0 default

shorewallもこの方法で起動した方が良いでしょう。

#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall/files/shorewall.initd,v 1.4 2013/07/13 14:09:09 constanze Exp $

command=/usr/sbin/shorewall
extra_commands="check clear"
extra_started_commands="refresh reset safe_restart"

depend() {
#	need net
	provide firewall
	after rsyslog
}

start() {
	checkpath -d -m 755 /var/lock/subsys
	ebegin "Starting shorewall"
	$command -f start 1>/dev/null
	eend $?
}

stop() {
	ebegin "Stopping shorewall"
	$command stop 1>/dev/null
	eend $?
}

safe_restart() {
	ebegin "Safely restarting shorewall"
	$command safe-restart 1>/dev/null
	eend $?
}

clear() {
	# clear will remove all the rules and bring the system to an unfirewalled
	# state. (21 Nov 2004 eldad)

	ebegin "Clearing all shorewall rules and setting policy to ACCEPT"
	$command clear
	eend $?
}

reset() {
	# reset the packet and byte counters in the firewall

	ebegin "Resetting the packet and byte counters in the shorewall"
	$command reset
	eend $?
}

refresh() {
	# refresh the rules involving the broadcast addresses of firewall
	# interfaces, the black list, traffic control rules and
	# ECN control rules

	ebegin "Refreshing shorewall rules"
	$command refresh
	eend $?
}

check() {
	# perform cursory validation of the zones, interfaces, hosts, rules
	# and policy files. CAUTION: does not parse and validate the generated
	# iptables commands.

	ebegin "Checking configuration files"
	$command check
	eend $?
}
ting system message bus: dbusdbus-daemon[1455]: Failed to start message bus: Could not get UID and GID for username "messagebus"
# groupadd -g 991 messagebus
# useradd -c 'System Message Bus' -u 991 -g messagebus -d '/nonexistent' -s /usr/sbin/nologin messagebus
useradd warning: dbus's uid 991 outside of the UID_MIN 1000 and UID_MAX 60000 range.

#!/sbin/openrc-run

description="Starts the rsyslogd enhanced system logging daemon"
command="/usr/sbin/rsyslogd"
command_args="-n"
supervisor=supervise-daemon

depend() {
	provide logger
	after bootmisc
}

LXC

ついでにコンテナのLXCでdebianとopenwrtもアップグレードしました。debianのi386のtrixieは最後のバージョンです。公式にはサポートが外れますがまだ使えるのでそのまま続行します。openwrtは安定版がv24.10.5です。サイトからrootfs.tar.gzをダウンロードして展開すればすぐ使えます。アップグレードは大きな問題はありませんが、dovecotの設定が大幅に変更になって再設定が必要です。詳しくは次のサイトにあります。

  • https://openwrt.org/docs/guide-user/virtualization/lxc
  • https://www.debian.org/releases/trixie/release-notes/issues.html

参考

  • https://www.debian.org/releases/forky/arm64/apds03.en.html
  • https://wiki.debian.org/Debootstrap
  • https://wiki.debian.org/OpenRC
  • https://wiki.debian.org/Init
  • https://www.cyberciti.biz/security/how-to-unlock-luks-using-dropbear-ssh-keys-remotely-in-linux/

Posted in Linux | Comments Off on Linux: Debian trixieのOpenRC化

Linux: Devuan Linux

Samsung ChromebookにいれたDevuan Linuxが良かったのでx86のPCに入っているMX Linuxから変更することにしました。インストールするまでの道のりが大変でした。ラップトップPCなのでdm-cryptでルートパーティションを暗号化するのに標準のインストーラーではスムーズにいきませんでした。ブートするとinitramfs内で止まってしまうのでそこから修復を始めます。

mkdir /mnt
mount /dev/mapper/root_fs /mnt
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
chroot /mnt
mount /dev/sda[bootディレクイトリ] /boot
mount /dev/sda1 /boot/efi

 chrootでシステムに入ります。/etc/default/grubと/etc/crypttabを変更しました。crypttabの設定はMX Linuxからのパクリです。

GRUB_CMDLINE_LINUX_DEFAULT="quiet root=/dev/mapper/root_fs"
root_fs		UUID=fxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx		none	luks,keyscript=decrypt_keyctl,no-read-workqueue,no-write-workqueue,discard

そしてブート関連のコマンドを自分の知る限り打ち込みます。今回のエラーでは暗号化ディスクが解除できてるがrootにマウントができないエラーだったので、カーネルのブートオプションのroot=で暗号解除されたファイルシステムのUUIDが指定されていれば動きます。

grub-install
update-grub
update-initramfs -u

macOSとディアルブートなのでrefindブートローダーも入れておいたほうがもしものときに安全です。

Debianパッケージのインストール

もう一つ困ったことはリポジトリにパッケージがない問題です。PCの一つがBroadcomのwifiだったのでそのドライバーを入れようとしたところ見つかりません。インストール時に入れるようになってるようで見過ごしていました。調べてみるとDebianと互換性があるのでサイトからDebianのパッケージをダウンロードしてdpkgコマンドでインストールできます。dkmsパッケージなどビルド環境を構築してインストールします。

zram

Samsung ChromeBookでzramを使っているのですが物理swapを使うより快適だったのでPCでも使うことにしました。リポジトリのパッケージでは使い方がよくわからない。それでChromeBookを調べてzramのinitスクリプトをパクって使うことにしました。

#! /bin/bash
### BEGIN INIT INFO
# Provides:          zram
# Required-Start:
# Required-Stop:
# Default-Start:     1
# Default-Stop:
# Short-Description: enabling zram (compressed swap in RAM).
### END INIT INFO

PATH=/sbin:/bin:/usr/bin:/usr/sbin

. /lib/lsb/init-functions

do_start () {
	log_action_msg "Enabling ZRAM,"
	modprobe zram
	# disable zswap
	if [ "$(cat /sys/module/zswap/parameters/enabled)" != "0" ]; then
	     echo 0 > /sys/module/zswap/parameters/enabled
	fi
	if $(ls /dev | grep -q zram0); then
	    ramdivider=4
	    log_action_msg "will be used near 1/$ramdivider of RAM."
	    zramsize="$((($(grep MemTotal /proc/meminfo | tr -dc '0-9')/($ramdivider*4096))*4096))KiB"
	    zramctl /dev/zram0 --algorithm zstd --size "$zramsize"
	    log_action_msg "ZRAM size $zramsize"
	    mkswap /dev/zram0
	    swapon --priority 100 /dev/zram0
	else
	    echo "Sorry, something went wrong"
	fi
}

do_stop () {
	log_action_msg "Disabling ZRAM"
	swapoff /dev/zram0
	if $(lsmod | grep -q zram); then
	    rmmod zram
	fi
}

case "$1" in
  start)
	do_start
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  stop)
	do_stop
	;;
  status)
	zramctl
	free
	;;
  *)
	echo "Usage: $0 start|stop|status" >&2
	exit 3
	;;
esac

systemdで慣れていたので、色々調べて次のコマンドでデーモンを登録しました。

rc-update add zram default

ついでにinitシステムをOpenRCに置き換えました。単にChromeBookのブート画面がキレイという理由だけです。実際に起動が速くなったで良しとします。

その他

Getty

そのままではGettyが使えないので追加します。

openrc-initを使う場合はinittabを読まないため gettyが使えません。デフォルトのinitであればせってする必要はありません。

openrc-initを使う場合は、次のように追加します。

cd /etc/init.d/
for n in `seq 1 6`; do ln -s agetty agetty.tty$n; rc-update add agetty.tty$n default; done 

さらに/etc/default/grubにinit=/usr/bin/openrc-initをカーネルパラメータに追加します。

終了コマンドは次のようになります。そのまま抜粋してあります。

Shutdown

Important:

shutdown, reboot and halt will not work anymore.

New syntax:

shutdownopenrc-shutdown -p [time]
rebootopenrc-shutdown -r [time]
haltopenrc-shutdown -H [time]

参考

  • https://wiki.gentoo.org/wiki/OpenRC/openrc-init
  • https://wiki.alpinelinux.org/wiki/OpenRC
  • https://wiki.archlinux.jp/index.php/OpenRC
  • https://wiki.debian.org/OpenRC

Posted in Linux | Comments Off on Linux: Devuan Linux

MacOS: Enroll in Remote Managementの除去

Lenovo ThinkCentre M73 TinyにmacOSをインストールしたときにDevice Enrollment Programが立ち上がってどうしようもなくなった時の対処方法です。

Redditで議論されてましたが、概ねそれに沿ったやり方で対処します。

リカバリーモードでOSを立ち上げます。

launchctl disable system/com.apple.ManagedClient.enroll
rm -rf /var/db/ConfigurationProfiles/Settings/.cloudConfigHasActivationRecord
rm -rf /var/db/ConfigurationProfiles/Settings/.cloudConfigRecordFound
touch /var/db/ConfigurationProfiles/Settings/.cloudConfigProfileInstalled
touch /var/db/ConfigurationProfiles/Settings/.cloudConfigRecordNotFound
rm -rf /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigHasActivationRecord
rm -rf /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigRecordFound
touch /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigProfileInstalled
touch /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigRecordNotFound

通常モードで立ち上げます。ネットワークはオフにします。

sudo /bin/sh -c 'echo "0.0.0.0 iprofiles.apple.com" >> /etc/hosts'
sudo /bin/sh -c 'echo "0.0.0.0 mdmenrollment.apple.com" >> /etc/hosts'
sudo /bin/sh -c 'echo "0.0.0.0 deviceenrollment.apple.com" >> /etc/hosts'
sudo /bin/sh -c 'echo "0.0.0.0 gdmf.apple.com" >> /etc/hosts'

リブートして確認します。

Posted in macOS | Comments Off on MacOS: Enroll in Remote Managementの除去

Samsung Chromebook: Devuan Linuxのインストール

随分前にChromeOSでは飽き足らずArch Linuxを入れて使っていましたがグラフィックスアクセラレーションが効いておらず実用的ではないということであまり使っていませんでした。しかし最近になってアクセラレーションが使えているということがわかったので早速セットアップしてみることにしました。

  • https://github.com/quarkscript/linux-armv7-xe303c12-only

このサイトからいくつかディストリビューションの候補があり好きなものをダウンロードできます。muslバージョンのVoid-linuxが魅力的だったのですが、使ってみるとバージョンアップしたFirefoxがセグメントフォールトで使えないということが判明したので候補から除きました。最終的にDevuan with xfce4 DEに決めました。debianじゃないけど使い方がdebianと同じ。違いはsystemdを使っていないこと。自分としてはどちらでも良く安定してパッケージ管理が行き届いていれば良かったので試してみます。

グラフィクスアクセラレーションの鍵となるのはMesaライブラリを動かすPanfrostというドライバーの開発で最下位バージョンのMidgardアーキテクチャー後回しということでいつまで経っても出てこずすっかり忘れていた時、今回の発見でいつの間にか完成していたことに気づきました。以前はOrangePiでPanfrostを弄っていたいた経験があるので、ビルドは難しい範疇になります。それでサイトからダウンロードしたイメージをブートして使えれば、そのまま使ってしまおうということで、今回はDevuan with xfce4 DEを本体にインストールしました。

まずは失敗から、イメージをそのままeMMCに焼き付けたらシステムが文鎮化しました。EFIのパーティションは残しておかないといけません。それでもう一度、ChomeOSの復旧から始めます。

ChomeOSの復旧

手順としてはChomeブラウザのAddonのChromebook Recovery Utilityを使います。ただしこれを使うとオリジナルのChromeOSではなくAI用のChromeOSがインストールされますので、旧バージョンのchromeos_11021.81.0_daisy_recovery_stable-channel_snow-mp-v4.bin.zipをどこからかのサイトからダウンロードしてこのツールを使って復旧します。

Esc+リフレッシュボタン+パワーボタンでリカバリーモードにします。そしてCtrl+Dで一旦、ChromeOSを立ち上げてCtrl+Alt+Tでcrosh shellを立ち上げます。そしてshellを打ち込んでsudoでroot権限を使えるようにして、

crossystem dev_boot_usb=1 dev_boot_signed_only=0

これを実行してリブートします。そうするとSDカードからLinuxがブートできるようになります。

ダウンロードしたLinuxイメージをSDを焼き付けて、それをGpartedでrootパーティションを拡張させたものを使います。

gunzip -c -d xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img.gz | dd of=/dev/mmcblk1 bs=1M

Linuxのインストール

インストール手順は概ねArch linuxのサイト通りです。

  • https://archlinuxarm.org/platforms/armv7/samsung/samsung-chromebook
Disk /dev/mmcblk1: 28.85 GiB, 30979129344 bytes, 60506112 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Device         Start      End  Sectors  Size Type
/dev/mmcblk1p1  8192    40959    32768   16M ChromeOS kernel
/dev/mmcblk1p2 40960 60504063 60463104 28.8G Linux filesystem


Disk /dev/mmcblk0: 14.68 GiB, 15758000128 bytes, 30777344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Device            Start      End  Sectors  Size Type
/dev/mmcblk0p1  8704000 30777295 22073296 10.5G Microsoft basic data
/dev/mmcblk0p2    20480    53247    32768   16M ChromeOS kernel
/dev/mmcblk0p3  4509696  8703999  4194304    2G ChromeOS root fs
/dev/mmcblk0p4    53248    86015    32768   16M ChromeOS kernel
/dev/mmcblk0p5   315392  4509695  4194304    2G ChromeOS root fs
/dev/mmcblk0p6    16448    16448        1  512B ChromeOS kernel
/dev/mmcblk0p7    16449    16449        1  512B ChromeOS root fs
/dev/mmcblk0p8    86016   118783    32768   16M Microsoft basic data
/dev/mmcblk0p9    16450    16450        1  512B ChromeOS reserved
/dev/mmcblk0p10   16451    16451        1  512B ChromeOS reserved
/dev/mmcblk0p11      64    16447    16384    8M unknown
/dev/mmcblk0p12  249856   315391    65536   32M EFI System

Partition table entries are not in disk order.


Disk /dev/mmcblk0boot0: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0boot1: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/zram0: 500 MiB, 524288000 bytes, 128000 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

fdisk /dev/mmcblk0

前述の通りEFIパーティション以外は消さないようにして変更します。

この時gを押してパーティションを変更しないように注意します。

       start        size    part  contents
           0           1          PMBR (Boot GUID: 8xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
           1           1          Pri GPT header
           2          32          Pri GPT table
        8192       32768       1  Label: "Kernel"
                                  Type: ChromeOS kernel
                                  UUID: Bxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                                  Attr: priority=10 tries=5 successful=1 
      249856       65536      12  Label: "EFI-SYSTEM"
                                  Type: EFI System Partition
                                  UUID: 8xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                                  Attr: legacy_boot=1 
    30777311          32          Sec GPT table
    30777343           1          Sec GPT header

rootパーティションを作ります。

cgpt add -i 2 -t data -b 315392 -s `expr 30777311 - 315392` -l Root /dev/mmcblk0

Devuan with xfce4 DEのイメージからカーネルを取り出します。

gunzip xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img.gz

snow# fdisk -l xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img 
Disk xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img: 1.84 GiB, 1973420032 bytes, 3854336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Device                                      Start     End Sectors  Size Type
xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img1  8192   40959   32768   16M ChromeOS
xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img2 40960 3854302 3813343  1.8G Linux fi

snow# dd if=xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img of=kernel.img bs=512 skip=8192 count=32768
32768+0 records in
32768+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 1.02353 s, 16.4 MB/s

rootパーティションをbtrfsでフォーマットします。この時、UUIDをメモしておきます。

fdisk -l /dev/mmcblk0
mkfs.btrfs /dev/mmcblk0p2
cd /tmp
mkdir root
mount /dev/mmcblk0p2 root

Devuan with xfce4 DEのイメージマウントしてファイルをコピーしします。cpコマンドでファイルの属性を正確にコピーできるか不安ですが、良い方法があれば、たとえばcpioなど使った方が良いでしょう。

snow# mkdir /tmp/img
snow# mount -o loop,offset=$(( 40960 * 512 )) /home/user/Downloads/xe303c12_dev4_xfce_6.12.20_1882m_btrfs.img /mnt/img
snow# cd /tmp/img
snow# ls
bin   chrooty  etc   lib    mnt  proc  run   srv  tmp  var
boot  dev      home  media  opt  root  sbin  sys  usr
snow# cp -a * ../root

コピーしたrootの/etc/fstabを編集してメモしたUUIDにします。

カーネルを書き込みます。

dd if=kernel.img of=/dev/mmcblk0p1 bs=512
32768+0 records in
32768+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 3.42462 s, 4.9 MB/s

syncコマンドを実行してリブートします。そしてデベロップモードになったらCtrl+Dで起動します。

Post Installation

まだ問題が残っていて、mesaライブラリは独自パッケージなので公式リポジトリからアップグレードするとGUIが壊れます。それなのでパッケージをホールドさせておきます。しかしながら公式パッケージと整合性が取れなくなる時点でmesaパッケージの再構築の必要があります。

libegl-mesa0
libegl1-mesa
libgl1-mesa-dri
libglapi-mesa
libgles2-mesa
libglu1-mesa
libglx-mesa0
libosmesa6
mesa-opencl-icd
mesa-va-drivers
mesa-vdpau-drivers
mesa-vulkan-drivers
libgbm1
sudo -s
cat pkg_list.txt | while read l; do apt-mark hold $l; echo $l; done
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL version string: 2.1 Mesa 20.3.5
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 20.3.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Exstras

ユーザーの変更

追記:deluserとadduserコマンドを使うほうが確実です。

ユーザー名がuserなのでこれを変更します。実際にやってみるとかなり手間のかかる作業でした。

adduserコマンドで追加しても良いのですが、余計なアカウントは増やしたくないのでuserをいつも使っているIDに変更します。

/etcのディレクトリにある次のファイルを変更します。

passwd
passwd-
shadow
shadow-
group
group-
gshadow
gshadow-
default/nodm

ホームディレクトリを自分のIDにリネームします。

ホームディレクトリに移動して.config以下のuserを自分のIDに合わせます。そして.cacheをすべて消します。

暗号化

dm-cryptを使ったディスクの暗号はimitramfsを使えば全体を暗号化できるのですが、ChromeBookはモノリシックカーネルのためできません。そこでhomeディレクトリだけを暗号化します。gpartedでrootfsのパーティションを分割しておきます。このChrombookではなぜかできなかったので他のPCを使って作業しました。

eMMCの容量は16Gbで分割するとシステムのスペースが厳しくなるので8GBのSDカードを使いました。別に32GbのSDカードにもインストールしました。東芝系のキオクシアカードで5年の保証付きだったので、eMMCが書き込み負荷で壊れるより取り替えのきくSDカードで動かしたほうが安定的に使うには適しています。SDカードから立ち上げるときはCtrl+uで起動します。

暗号化の手順は割愛するとして、起動時に解除するには/etc/crypttabを編集します。UUIDは解除したいパーティションのUUIDを指定します。

home UUID=9xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxf none timeout=10

つぎに暗号解除してディスクをフォーマットします。今回はbtrfsにしました。/etc/fstabに追加します。

UUID=exxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home btrfs rw,compress-force=zstd:7,ssd 0 0

Screenshot

サウンド

インストール時はサウンドが使えない状態です。ドライバーがロードされてOS上では問題なく動いているので不思議に思っていました。USBオーディオでしばらく使っていたのですが、ArchlinuxのさいとのWikiを見ていたらサウンドの有効化について書いてあったのでその通りにしたら使えるようになりました。ただしイヤフォンジャックからの出力はできませんでした。

amixer -c 0 set 'Right Speaker Mixer Right DAC1' unmute
amixer -c 0 set 'Right Speaker Mixer Mono DAC3' unmute
amixer -c 0 set 'Right Speaker Mixer Mono DAC2' unmute
amixer -c 0 set 'Right Speaker Mixer Left DAC1' unmute
amixer -c 0 set 'Left Speaker Mixer Right DAC1' unmute
amixer -c 0 set 'Left Speaker Mixer Mono DAC3' unmute
amixer -c 0 set 'Left Speaker Mixer Mono DAC2' unmute
amixer -c 0 set 'Left Speaker Mixer Left DAC1' unmute
Posted in Chromebook | Comments Off on Samsung Chromebook: Devuan Linuxのインストール

Thinkpad x230i: macOS Sequoiaのセットアップ

かなり苦戦しましたがIvy-bridgeのx230iでもSequoiaにアップグレードできました。SonomaあたりからUSBインストールができなくなっており、一旦Venturaをインストールしておき、そこからアップグレードする形になります。

https://github.com/Neelakurinji123/Thinkpad-x230i-OpenCore

x230iにはBluetoothがないのでドングルをインストールしてみましたがあと一歩の所で出来ませんでした。

ドライバーは認識できたものの問題の箇所は、

% blueutil
Power: 1
Discoverable: 0

このようにデバイスが発見できないという致命的な問題があります。これはMacOSのシステムの問題なので現在のところ対処方法は難しい状況です。

検索してところプライベートAPIを使うと出来るらしいのですがAppleはプライベートAPIを禁止しているというデメリットがあります。トラブルを承知で使うという手もありますがリスクが高いです。

// Source - https://stackoverflow.com/a
// Posted by edi
// Retrieved 2025-12-10, License - CC BY-SA 3.0

// Declaration of private API
void IOBluetoothPreferenceSetDiscoverableState(int discoverable);
int IOBluetoothPreferenceGetDiscoverableState();

// Usage
// Turn on Discoverability
IOBluetoothPreferenceSetDiscoverableState(1);
// Get current discoverable state
IOBluetoothPreferenceGetDiscoverableState()

それとCSR 4.0というBTドングルを使用していますが、これも相性があって全てのCSRで使えず、TP-linkのUB400が使えることを確認しています。またBlueToolFixupもv2.7.1だと認識しません。

参考

  • https://www.reddit.com/r/hackintosh/comments/1gvu5n1/broadcom_wifi_on_macos_sonoma_and_sequoia_fenvi/
  • https://dortania.github.io/Getting-Started-With-ACPI/Universal/dmar-methods/manual.html#preparation
  • https://elitemacx86.com/threads/how-to-fix-broadcom-wifi-on-macos-sonoma-and-later.1415/
  • https://gist.github.com/sghiassy/a3927405cf4ffe81242f4ecb01c382ac
  • https://www.reddit.com/r/hackintosh/comments/1g4z5te/how_to_make_generic_csr_usb_bluetooth_5040_dongle/?utm_source=embedv2&utm_medium=post_embed&utm_content=post_body&embed_host_url=https://www.insanelymac.com/index.php
  • https://stackoverflow.com/questions/7493279/how-to-set-bluetooth-discoverable-mode-in-os-x-programmatically

Posted in macOS | Comments Off on Thinkpad x230i: macOS Sequoiaのセットアップ

Thinkpad x260: macOS Somonaのセットアップ

Venturaがアップルのサポートから外れたので Somonaにアップグレードしました。当初Sequoiaにアップグレードしたのですが、グラフィックスが思うように設定できず Somonaとなりました。Skylakeはspoofingというやり方で使えるのですが、OCLPのルートパッチのグラフィクスを当てるやり方もあります。しかし検索してもどうもその方法で成功した事例も見つからず、どれもspoofingの方法を使っていたので、おそらくルートパッチは何らかの理由で使えないだろうということで、Somonaにしました。若干EFIを修正して無事成果物が完成しました。

https://github.com/Neelakurinji123/ThinkPad-x260-OpenCore

追記: Sequoiaにアングレードできました。spoofingのやり方で大丈夫でした。

Posted in macOS | Comments Off on Thinkpad x260: macOS Somonaのセットアップ

ThinkPad x390にmacOSをインストール

デスクトップ用MacのM4が欲しいなと見ていたのですが、最安値ですら手の届かない価格でしたので、今回最後のThinkPadのMacOS化をすることにしました。機種はx390です。この機種ほほぼx280とスペックは同じですが、サイズが若干大きく、従来のxシリーズと一線を画しています。

中古で購入して真っ先に状態チェックしたところとても良好でした。バッテリーやSSDの状態がほぼ80%くらいなので数年は持ちそうな感じです。

SSDは256GBでそれほど多い容量ではありませんが私的にはあまり多くは要らないのでOKです。このうち32GBをMX Linuxに割り当てて約220GBがmacOSに割り当てました。

Sonomaをインストールして問題なかったのでSequoiaにしておいて方が後々いいなということで再インストールしました。wifiをitlwm WiFi kext + HeliPort にしました。将来的にTahoeにアップグレードを見据えてのことです。HeliPortはあまり使い勝手が良くなく、固定IPなどはできません。また今の状態でacモードが接続ができなくてaモードで接続しています。

追記:aモードだと遅くて不便なので従来のAirportItlwm方式に変えてみました。今度はacモードでも問題なく稼働しています。

  • 5T33Z0/Thinkpad-T490-Hackintosh-OpenCore:https://github.com/5T33Z0/Thinkpad-T490-Hackintosh-OpenCore

Posted in macOS | Comments Off on ThinkPad x390にmacOSをインストール

Kindle: Picture frameの制作 (2)

ピクチャーフレームの制作をしました。ホームセンターでたまたまバンブーボードを見つけたのでそれを購入しました。広葉樹のボードの方が緻密で綺麗ですが、竹でも十分綺麗だと思ったのでそれにしました。フレームの木片は家にあったものをかき集めて作りました。エポキシ系樹脂の接着剤で固定しましたが、調整した時にずれていましました。😅

裏面はこんな感じです。

kindleを固定するのにちょうどいい粘着タックがあったのでそれを使います。またケーブル端子がはみ出さないようにL型のUSB miniが売ってたのでそれを使います。

最後はガムテープで固定します。

バンブーボードは紙やすりで磨いてから、くるみオイルで仕上げて完成😄

材料費

  • バンブーボード: 210円
  • 粘着タック: 100円
  • L型USBminiケーブル: 100円
  • USB延長ケーブル: 100円
  • エポキシ系樹脂接着剤: 100円
  • kindle PW1 中古品: 1500円
Posted in kindle | Comments Off on Kindle: Picture frameの制作 (2)

Kindle: Picture frameの制作

作成

ffmpeg -i Gen-2\ 1112308358,\ A\ serene\ forest\ scen,\ IMG_20230604.mp4 -vf "crop=900:765:50:50" video.mp4
ffmpeg -i video.mp4 -vf fps=3 frame%02d.png

gcc raw2gmv_pw1.c -o raw2gmv_pw1
gcc raw2gmv_k3.c -o raw2gmv_k3


ffmpeg -i video.mp4 -i mask.png \
-filter_complex "[0:v][1:v] overlay=0:0" -c:a copy \
-pix_fmt gray \
 -s 1024x768 output_pw1.mp4

ffmpeg -i video.mp4 -i mask.png \
-filter_complex "[0:v][1:v] overlay=0:0" -c:a copy \
-pix_fmt gray \
 -s 800x600 output_k3.mp4

ffmpeg -i output_pw1.mp4  -pix_fmt gray -f rawvideo out_pw1.raw
ffmpeg -i output_k3.mp4  -pix_fmt gray -f rawvideo out_k3.raw

cat out_pw1.raw | ./raw2gmv_pw1 > video_pw1.gmv
cat out_k3.raw | ./raw2gmv_k3 > video_k3.gmv

gzip video_pw1.gmv
gzip video_k3.gmv

参考

Posted in kindle | Comments Off on Kindle: Picture frameの制作