Imagemagick 6.9.11-60 no Debian. Como imprimir a data e hora em que a foto foi tirada na imagem? (em imagens existentes). Eu configurei essa opção nas configurações da câmera, mas ela só se aplica a novas fotos. A data está na imagem metatada. Deve ser a data real em que a foto foi tirada, não a data em que foi salva no disco rígido do PC.
minto's questions
É seguro remover pacotes linux-image-5.10.0-21-amd64, linux-image-5.10.0-23-amd64? Depois de remover alguns pacotes de idiomas desnecessários do Firefox com dependências, fui solicitado a remover automaticamente alguns pacotes que não eram mais necessários: hunspell-gl-es, hunspell-sv-se, linux-image-5.10.0-21-amd64, linux-image-5.10.0-23-amd64
.
$ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
hunspell-gl-es hunspell-sv-se linux-image-5.10.0-21-amd64 linux-image-5.10.0-23-amd64
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 636 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 253674 files and directories currently installed.)
Removing hunspell-gl-es (1:7.1.0~rc3-3) ...
Removing hunspell-sv-se (1:7.1.0~rc3-3) ...
Removing linux-image-5.10.0-21-amd64 (5.10.162-1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.10.0-21-amd64
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-25-amd64
Found initrd image: /boot/initrd.img-5.10.0-25-amd64
Found linux image: /boot/vmlinuz-5.10.0-24-amd64
Found initrd image: /boot/initrd.img-5.10.0-24-amd64
Found linux image: /boot/vmlinuz-5.10.0-23-amd64
Found initrd image: /boot/initrd.img-5.10.0-23-amd64
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
done
Removing linux-image-5.10.0-23-amd64 (5.10.179-3) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.10.0-23-amd64
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-25-amd64
Found initrd image: /boot/initrd.img-5.10.0-25-amd64
Found linux image: /boot/vmlinuz-5.10.0-24-amd64
Found initrd image: /boot/initrd.img-5.10.0-24-amd64
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
done
Editar:
pacotes atuais:
$ apt list -i 'linux-image*'
Listing... Done
linux-image-5.10.0-24-amd64/now 5.10.179-5 amd64 [installed,local]
linux-image-5.10.0-25-amd64/oldstable-security,now 5.10.191-1 amd64 [installed,automatic]
linux-image-5.10.0-26-amd64/oldstable,now 5.10.197-1 amd64 [installed,automatic]
linux-image-5.10.0-9-amd64/now 5.10.70-1 amd64 [installed,local]
linux-image-amd64/oldstable,now 5.10.197-1 amd64 [installed]
Eu quero encontrar cópias repetidas da seção de configuração dentro do despejo de partição (arquivo binário), usando padrão e cabeçalho 'mágico'. A seção de configuração sempre começa com 202 '0xff'
bytes seguidos por 4 bytes '\x00\x00\x23\x27'
. O script deve identificar diferentes cópias de configuração dentro da partição e imprimir endereços (em bytes) onde as ocorrências do padrão iniciam. Ajustei um script python existente para o meu padrão, mas não funciona, apenas gera erros devido à mistura de bytes com strings. Como consertar esse script?
#!/usr/bin/env python3
import re
import mmap
import sys
magic = '\xff' * 202
pattern = magic + '\x00\x00\x23\x27'
fh = open(sys.argv[1], "r+b")
mf = mmap.mmap(fh.fileno(), 0)
mf.seek(0)
fh.seek(0)
for occurence in re.finditer(pattern, mf):
print(occurence.start())
mf.close()
fh.close()
erros:
$ ./matcher.py dump.bin
Traceback (most recent call last):
File "/home/eviecomp/BC2UTILS/dump_previous_profile/./matcher.py", line 13, in <module>
for occurence in re.finditer(pattern, mf):
File "/usr/lib/python3.9/re.py", line 248, in finditer
return _compile(pattern, flags).finditer(string)
TypeError: cannot use a string pattern on a bytes-like object
padrão e magia:
Preciso instalar a biblioteca Boost CRC no Debian 11.7. Eu procurei no Synaptic Package Manager, mas não o encontrei.
Além disso, eu preferiria instalar apenas essa biblioteca específica (em uma configuração mínima), sem um grande número de pacotes e bibliotecas Boost adicionais, se possível.
Eu tentei xmlstarlet para processar arquivos .xhtml individuais.
xmlstarlet fo --omit-decl --recover --html file.xhtml
Este comando processa arquivos individuais e imprime a saída apenas no terminal. Como processar vários arquivos em lote e salvar os resultados stdout
como arquivos? (com o mesmo nome, adicionando prefixo ou sufixo para arquivos)
Eu preciso substituir o caminho para a imagem em vários arquivos xhtml no diretório. A parte principal dos arquivos é a seguinte:
<?xml version="1.0" encoding="UTF-8"?>
<html xml:lang="en-us" lang="en-us" xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ns="http://www.w3.org/2001/10/synthesis">
<head>
Tentei fazer isso com sed
comando, mas não funciona. Possivelmente devido a uma versão específica do sed, mas não tenho certeza. Eu tenhoGNU sed 4.4
original path:
<img src="/api/v2/epubs/urn:orm:book:381260143574/files/line.jpg"
I need replace to:
<img src="graphics/line.jpg"
eu tentei
sed -i '.bak' 's/\/api\/v2\/epubs\/urn:orm:book:381260143574\/files/graphics/g' '*.xhtml'
ele retorna
sed: -e expression #1, char 1: unknown command: `.'
também tentei
sed -i ' ' 's/\/api\/v2\/epubs\/urn:orm:book:381260143574\/files/graphics/g' '*.xhtml'
it return
sed: can't read s/\/api\/v2\/epubs\/urn:orm:book:381260143574\/files/graphics/g: No such file or directory
sed: can't read *.xhtml: No such file or directory
O sed
indicado é para isso?
qual é a maneira mais prática de anexar o bloco html de várias linhas ao topo das páginas html no diretório? Eu tenho vários arquivos XHTML no diretório, sem uma parte de cabeçalho e sem fechar tags na parte inferior. Eu preciso anexar o código ao topo de cada arquivo XHTML (parte do cabeçalho inclui a tag do corpo) e à parte de fechamento na parte inferior. ( </body></html>
) Não 'localizar e substituir', mas anexar os mesmos trechos de html a todos os arquivos. Tentei usar a folha de estilo XSLT2.0 com o processador de linha de comando Gestalt XSLT2.0, mas gera muitos erros, não tem documentação e o projeto foi descontinuado.
Eu quero verificar a versão glibc usada pelo toolchain para construir o código para o sistema de destino (ARM). No diretório da cadeia de ferramentas eu tentei
strings /sysroot/lib/libc.so.6 | grep GLIBC
a saída é
GLIBC_2.4
GLIBC_2.5
GLIBC_PRIVATE
__moddi3@GLIBC_2.4
__divdi3@GLIBC_2.4
__umoddi3@GLIBC_2.4
__udivdi3@GLIBC_2.4
_IO_file_xsputn@@GLIBC_2.4
getaliasent_r@@GLIBC_2.4
fgetpos64@@GLIBC_2.4
sys_siglist@@GLIBC_2.4
_IO_file_underflow@@GLIBC_2.4
gethostent_r@@GLIBC_2.4
_IO_file_init@@GLIBC_2.4
readdir64_r@@GLIBC_2.4
fclose@@GLIBC_2.4
sys_nerr@@GLIBC_2.4
_IO_file_attach@@GLIBC_2.4
getrpcbyname_r@@GLIBC_2.4
setrlimit@@GLIBC_2.4
msgctl@@GLIBC_2.4
pclose@@GLIBC_2.4
scandir64@@GLIBC_2.4
getgrgid_r@@GLIBC_2.4
pthread_cond_wait@@GLIBC_2.4
_IO_fsetpos@@GLIBC_2.4
fopen@@GLIBC_2.4
getservent_r@@GLIBC_2.4
pthread_cond_timedwait@@GLIBC_2.4
getnetbyname_r@@GLIBC_2.4
getservbyport_r@@GLIBC_2.4
pthread_cond_broadcast@@GLIBC_2.4
getspent_r@@GLIBC_2.4
getaliasbyname_r@@GLIBC_2.4
getrpcent_r@@GLIBC_2.4
versionsort64@@GLIBC_2.4
getrlimit64@@GLIBC_2.4
gethostbyname_r@@GLIBC_2.4
GLIBC_2.5
_dl_tls_get_addr_soft@@GLIBC_PRIVATE
getprotobynumber_r@@GLIBC_2.4
_rtld_global_ro@@GLIBC_PRIVATE
glob64@@GLIBC_2.4
gethostbyaddr_r@@GLIBC_2.4
_IO_file_close_it@@GLIBC_2.4
pthread_cond_signal@@GLIBC_2.4
localeconv@@GLIBC_2.4
__libc_enable_secure@@GLIBC_PRIVATE
pthread_cond_destroy@@GLIBC_2.4
_sys_errlist@@GLIBC_2.4
__libc_stack_end@@GLIBC_2.4
sched_getaffinity@@GLIBC_2.4
tmpfile@@GLIBC_2.4
fdopen@@GLIBC_2.4
_dl_argv@@GLIBC_PRIVATE
getnetbyaddr_r@@GLIBC_2.4
realpath@@GLIBC_2.4
getrpcbynumber_r@@GLIBC_2.4
fopencookie@@GLIBC_2.4
_IO_do_write@@GLIBC_2.4
fgetpos@@GLIBC_2.4
semctl@@GLIBC_2.4
fsetpos64@@GLIBC_2.4
gethostbyname2_r@@GLIBC_2.4
getprotoent_r@@GLIBC_2.4
alphasort64@@GLIBC_2.4
_IO_fdopen@@GLIBC_2.4
getgrent_r@@GLIBC_2.4
GLIBC_2.4
_IO_file_setbuf@@GLIBC_2.4
__tls_get_addr@@GLIBC_2.4
_IO_fgetpos@@GLIBC_2.4
getspnam_r@@GLIBC_2.4
pthread_attr_init@@GLIBC_2.4
sys_sigabbrev@@GLIBC_2.4
nftw64@@GLIBC_2.4
sys_errlist@@GLIBC_2.4
getpwnam_r@@GLIBC_2.4
regexec@@GLIBC_2.4
_IO_proc_close@@GLIBC_2.4
_IO_file_fopen@@GLIBC_2.4
getnetent_r@@GLIBC_2.4
fnmatch@@GLIBC_2.4
popen@@GLIBC_2.4
_IO_fclose@@GLIBC_2.4
_IO_popen@@GLIBC_2.4
_IO_fsetpos64@@GLIBC_2.4
getpwent_r@@GLIBC_2.4
_IO_file_sync@@GLIBC_2.4
_sys_siglist@@GLIBC_2.4
shmctl@@GLIBC_2.4
fsetpos@@GLIBC_2.4
_sys_nerr@@GLIBC_2.4
_IO_file_overflow@@GLIBC_2.4
sched_setaffinity@@GLIBC_2.4
readdir64@@GLIBC_2.4
_IO_fgetpos64@@GLIBC_2.4
_IO_fopen@@GLIBC_2.4
_rtld_global@@GLIBC_PRIVATE
_res@GLIBC_2.4
pthread_cond_init@@GLIBC_2.4
nftw@@GLIBC_2.4
getrlimit@@GLIBC_2.4
_IO_proc_open@@GLIBC_2.4
getprotobyname_r@@GLIBC_2.4
_IO_file_finish@@GLIBC_2.4
getgrnam_r@@GLIBC_2.4
getpwuid_r@@GLIBC_2.4
getservbyname_r@@GLIBC_2.4
GLIBC_PRIVATE
_IO_file_write@@GLIBC_2.4
_IO_file_seekoff@@GLIBC_2.4
Qual é a versão real da glibc usada, 2.4 ou 2.5?
Estou usando o busybox em um dispositivo incorporado. O busybox embutido é bastante limitado. Então eu quero tentar substituir o busybox no lugar por uma versão nova e mais completa. Eu encontro algumas informações sobre como substituir o Busybox no dispositivo usando comunicação serial e linha de comando, isso também requer um servidor http na LAN. A parte dos comandos
route add -net 192.168.15.0/24 eth0
mount -t tmpfs -o size=2M,mode=0755 tmpfs /mnt
cd /mnt
wget http://192.168.15.10/busybox-armv5l
chmod +x busybox-armv5l
Dois pontos não estão claros aqui: o novo busybox não substitui a versão existente, mas é adicionado em outro local como um busybox adicional? Em segundo lugar, o novo busybox é colocado em tmpfs na RAM: então não é salvo permanentemente na partição e excluído após uma reinicialização? Estou correcto?
qual comando é mais adequado para remover linhas em branco no arquivo de despejo hexadecimal, para unir as peças?
sed -i '/^$/d' file.log
sed -i '/^\s*$/d' file.log
ou talvez awk
?
801c3fb0: 0000 2821 0c18 9741 2406 0020 afb0 0010 | ..(!...A$.. ....
801c3fc0: 2402 0014 afa2 0038 8e22 00e4 2404 0064 | $......8."..$..d
801c3fd0: 0000 2821 03a0 3021 0040 f809 27a7 0038 | ..(!..0!.@..'..8
801c3fe0: 1040 001d 0040 9021 2630 0008 0200 2021 | .@...@.!&0.... !
801c3ff0: 0c0a 8935 2405 0002 5040 0064 0000 1021 | [email protected]...!
801c4000: 0200 2021 0c0a 8935 2405 0002 0200 2021 | .. !...5$..... !
801c4010: 0040 2821 2406 0002 3c07 8074 0c0a 86a5 | .@(!$...<..t....
801c4020: 24e7 10fc 0040 2021 3c05 8074 0c1b 634c | $....@ !<..t..cL
Eu tenho um arquivo de texto contendo uma lista de strings. As strings são separadas por novas linhas e têm o mesmo comprimento, 8 dígitos. Eu preciso dividir um arquivo maior em pedaços menores, onde cada pedaço contém 4 strings, todas as strings na mesma sequência que estão em um arquivo grande.
Então eu preciso criar 16 arquivos, 15 arquivos x 4 strings cada + 1 arquivo x 2 strings. Os arquivos devem ser nomeados como list1.txt
, list2.txt
, etc.
Qual é a maneira mais simples de resolver isso usando ferramentas como awk
, sed
, etc.?
Eu preciso converter uma lista de valores decimais em um arquivo de texto em formato hexadecimal, então, por exemplo, test.txt pode conter:
131072
196608
262144
327680
393216
...
a saída deve ser uma lista de valores hexadecimais (hex 8 dígitos, com zeros à esquerda):
00020000
00030000
00040000
...
a saída é impressa no arquivo de texto. Como fazer isso com script de shell python ou linux?
EDIÇÃO #1
Perdi uma operação extra: preciso adicionar 80000000
hexadecimal a cada um dos valores hexadecimais criados. (adição aritmética, para aplicar à lista já criada de valores hexadecimais).
Placa com CPU ARM926EJ, rodando Linux v2.6.26.5 embarcado, em dispositivo NAND Flash, NAND 32MiB. O Linux está em partições MTD no dispositivo NAND.
Como posso fazer backup da imagem do kernel do Linux (SP2Xcybertan_rom_bin) da interface serial? Como não há opção TFTP para transferir arquivos da placa para o PC host via tftp. Posso ler nand para algum endereço de memória, despejar a saída no terminal e salvar e, em seguida, converter hexadecimal em binário:
nand read 0x20000000 0x80000 0x0017FF80
md.b 0x20000000 0x0017FF80
No log do processo de inicialização:
U-Boot 2009.03 (Oct 06 2011 - 20:04:03)
Stack:->21F1EC74 U-Boot code: 21FC4D00->21FF9454 BSS:->21FFFF3B
CPU: PNX8181-2B OM6xxx-ARM926EJ-S(ARMv5TEJ) @ 221MHz(armclk), 110MHz(hclk)
Board: Vega_PNX8181_BaseStation Platform IV (LC)
I2C: ready
RAM Configuration:
Bank #0: 20000000 32 MB
NAND: 32 MiB
In: serial
Out: serial
Err: serial
Use Full Image's Kernel
Net: VLAN Mode
L2 switch present
ETN1
Hit any key to stop autoboot: 0
Loading from NAND 32MiB 3,3V 8-bit, offset 0x80000
Image Name: SP2Xcybertan_rom_bin
Created: 1970-01-01 0:00:-1 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1572736 Bytes = 1.5 MB
Load Address: 20008000
Entry Point: 20008000
## Booting kernel from Legacy Image at 20200000 ...
Image Name: SP2Xcybertan_rom_bin
Created: 1970-01-01 0:00:-1 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1572736 Bytes = 1.5 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.........
As variáveis de ambiente
firetux # printenv
baudrate=115200
ethaddr=FF:FF:FF:FF:FF:FF
netmask=255.255.255.0
ipaddr=192.168.1.1
serverip=192.168.1.100
bootfile=firetux.kernel
bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000
bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000
phymode=auto
mtdids=nand0=gen_nand
unlock=yes
verify=y
update.uboot=echo Update u-boot && tftpboot 0x20000000 nandboot.flash && nand erase 0x0 0x03ffff && nand write.jffs2 0x20000000 0x0 ${filesize}
update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000
update.romimg=echo Update RomImage && tftpboot 0x20000000 romimage.img && nand erase 0x80000 0x13e0000&& nand write.jffs2 20000000 0x80000 ${filesize}
update.halfimg=echo Update HalfImage && tftpboot 0x20000000 recovery.img && nand erase 0x1460000 0x700000&& nand write.jffs2 20000000 0x1460000 ${filesize}
eraseenv=echo Erase Environment && nand erase 0x60000 0x20000
HwModel=Hw_Model=SPA122
bootcmd=run bootcmd1
halfImage=half_image=0
cy_boot_code_ver=1.0.1 (Oct 6 2011 - 20:04:00)
RouterMode=Router_Mode=0
stdin=serial
stdout=serial
stderr=serial
bootcmd=run bootcmd1
image_addr=0x80000
bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=SPA122 Router_Mode=0
ethact=ETN1
bootdelay=3
Quais são as diferenças entre kernel(uImage) e romimage (romimg.img) em termos de processo de inicialização?