
Linux
文章平均质量分 74
lingedeng
海纳百川有容乃大,壁立千仞无欲则刚!
展开
-
linux VHD文件通过NFS启动
服务器端1. 安装ubuntu 18.04 nfs服务器# apt install nfs-kernel-server2. 加载nbd内核模块并使用qemu-nbd加载vhd文件(假设vhd文件包含三个分区),在/dev下生成nbd0p[1-3]三个分区,第三个分区为根分区# modprobe nbd# qemu-nbd -c /dev/nbd0 /path/to/pim_file3. 将/dev/nbd0p3挂载到需要共享的目录(例:/srv/nfs/root)# moun原创 2021-09-30 17:12:40 · 802 阅读 · 0 评论 -
systemd如何使用/etc/init.d脚本
1. 以apport为例,将/etc/init.d/apport拷贝并生成新的myapport, 内容如下:#! /bin/sh### BEGIN INIT INFO# Provides: myapport# Required-Start: $local_fs $remote_fs# Required-Stop: $local_fs $remote_fs# Default-Start: 2 3 4 5# Default-Stop:# Short-Descript原创 2021-09-29 17:10:55 · 2426 阅读 · 0 评论 -
Linux systemd单元启动配置及日志之graphical.target
accounts-daemon.service Description=Accounts Service Type=dbus BusName=org.freedesktop.Accounts ExecStart=/usr/lib/accountsservice/accounts-daemon # journalctl -b -u accounts-daemon.service -- Logs begin at Mon 2019-06-03 16:5...原创 2021-09-29 14:10:21 · 1350 阅读 · 0 评论 -
Linux systemd单元启动配置及日志之multi-user.target
anacron.service can be used to execute commands periodically, with a frequency specified in days. When executed, Anacron reads a list of jobs from a configuration file, normally /etc/anacrontab ExecStart=/usr/sbin/anacron -dsqapport.service...原创 2021-09-29 14:07:09 · 3381 阅读 · 0 评论 -
Linux systemd单元启动配置及日志之basic.target
systemd-ask-password-plymouth.servicesystemd-ask-password-plymouth.path Forward Password Requests to Plymouth Directory Watch Documentation=http://www.freedesktop.org/wiki/Software/systemd/PasswordAgents # journalctl -b -u systemd-ask-pa...原创 2021-09-29 13:52:08 · 1950 阅读 · 0 评论 -
Linux systemd单元启动配置及日志之sysinit.target
apparmor.serviceAppArmor is a kernel enhancement to confine programs to a limited set of resources. AppArmor's unique security model is to bind access control attributes to programs rather than to users. ExecStart=/etc/init.d/apparmor start ...原创 2021-09-29 13:42:49 · 1568 阅读 · 0 评论 -
Linux systemd单元启动配置及日志之local-fs.target
keyboard-setup.service: Set the console keyboard layout ExecStart=/lib/console-setup/keyboard-setup.sh # journalctl -b -u keyboard-setup.service -- Logs begin at Mon 2019-06-03 16:58:43 CST, end at Wed 2021-09-29 13:17:01 CST. --9月 26 09...原创 2021-09-29 13:29:08 · 1171 阅读 · 0 评论 -
Linux systemd启动流程
以Ubuntu 18.04.2 LTS为例,列出Systemd启动target中涉及单元(Unit).default.target (= graphical.target by default)graphical.target Requires=multi-user.target Wants=display-manager.service Conflicts=rescue.service rescue.target After=multi-user.target rescue.ser.原创 2021-09-14 13:27:31 · 1269 阅读 · 0 评论 -
Linux systemd 基础及命令
From theproject web page:systemdis a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system. systemd provides aggressive parallelization capabilities, uses socket..原创 2021-09-08 10:35:36 · 898 阅读 · 0 评论 -
linux kernel处理提要——字符设备
1. 字符设备dev_t管理关键结构和变量,使用hash表及开链法,hash算法为major % 255static struct char_device_struct { struct char_device_struct *next; unsigned int major; unsigned int baseminor; int minorct; char name[64]; struct cdev *cdev; /* will die */} *chrdevs[CHRDEV_MA原创 2021-07-30 11:15:41 · 178 阅读 · 0 评论 -
Linux kernel处理提要——模块加载
sys_init_module主要工作,load_module(kernel/module.c):1. 在内核空间建立模块的静态视图(从用户空间拷贝到内核空间)2. 获得段名,符号名称符号表的地址info->secstrings = (void *)info->hdr + info->sechdrs[info->hdr->e_shstrndx].sh_offset;if (info->sechdrs[i].sh_type == SHT_SYMTAB) {原创 2021-07-30 11:06:12 · 474 阅读 · 0 评论 -
linux ext2文件系统格式解析
1. 使用如下命令创建一个1.45M的img文件并加载格式化$dd if=/dev/zero of=1440.img bs=1k count=1440$modprobe loop$losetup /dev/loop0 1440.img$mke2fs -t ext2 /dev/loop0 或 mke2fs -t ext2 1440.img2. 使用dumpe2fs命令查看超级块和块组信息$ dumpe2fs /dev/loop0dumpe2fs 1.42.9 (4-Feb-2014)原创 2021-06-25 17:23:43 · 514 阅读 · 0 评论 -
Linux时区文件基本信息解析
使用"file/usr/share/zoneinfo/PRC"查看时区文件产生的输出信息:/usr/share/zoneinfo/PRC: timezone data, version 2, 3 gmt time flags, 3 std time flags, no leap seconds, 27 transition times, 3 abbreviation chars使用二进制查看工具打开时区文件,对应的关键信息:00000000: 545a 6966 3200 0000 0000.原创 2021-03-05 10:58:28 · 1486 阅读 · 1 评论 -
Busybox initrd及初始化流程
Initrd文件系统加载流程: 1. 引导加载程序,例如 GRUB,定义了要加载的内核,并将这个内核映像以及相关的 initrd 拷贝到内存中。我们可以在 Linux内核源代码目录中的 ./init 子目录中找到很多这种功能。 2. 在内核和 initrd映像被解压并拷贝到内存中之后,内核就会被调用了。它会执行不同的初始化操作,最终会发现自己到了init/main.c:init()...原创 2019-11-22 09:43:54 · 698 阅读 · 0 评论 -
Linux bash语法提要
$(command)|`command`: 执行相关的命令$[{]variable[}]: 获取变量的值$((计算式)):算术运算,只能进行整型计算,如果有小数时,可以使用bc命令进行辅助单引号('')不具备变量置换功能;双引号("")具备变量置换功能使用绝对或相对路径,以及[bash|sh] script.sh执行时都会使用一个全新的bash环境来执行script脚本而使用[sou...原创 2019-11-22 09:30:44 · 169 阅读 · 0 评论 -
Ubuntu 18.04 x86_64定制deepin LiveCD x86 ISO
参考:custom-debian-live-environment1. 准备工作安装制作所需的工具sudo apt-get install \ debootstrap \ squashfs-tools \ xorriso \ grub-pc-bin \ grub-efi-amd64-bin \ mtools创建目录mkdir ...原创 2019-11-12 20:18:23 · 1746 阅读 · 0 评论 -
Mariadb服务器二进制依赖包合成为一个RPM安装包
实验环境: 操作系统:CentOS7 x86_x64 Mariadb:mariadb-server-5.5.64-1.el7.x86_64.rpm及相关依赖包1. 准备Mariadb Server服务器rpm及相关依赖包,如下图2.通过如下命令将所有rpm包进行解压,实验时是根据包的依赖顺序进行解压(应该没有影响) rpm2cpio mariadb-li...原创 2019-10-12 17:44:20 · 735 阅读 · 0 评论 -
Linux ELF .gnu.hash生成
1. 生成原始动态库的源文件attr.h#include <cstdio>void not_hidden() __attribute__((visibility("default")));void is_hidden() __attribute__((visibility("hidden")));void Log(FILE* f, const char* form...原创 2019-01-23 17:32:09 · 2258 阅读 · 0 评论 -
ELF重定位分析
1. 变量访问///////////////////////////////////////////////////////////////ml_mainpic_data.c//gcc -fPIC -shared -g -o libmlpicdata.so ml_mainpic_data.cint myglob = 42;int ml_func(int a, int b) { ...原创 2019-01-21 16:37:08 · 1346 阅读 · 0 评论 -
ELF文件杂记
eu-readelf --helpUsage: eu-readelf [OPTION...] FILE...Print information from ELF file in human-readable form. ELF input selection: --elf-section[=SECTION] Use the named SECTION (default .g...原创 2019-01-21 16:18:10 · 573 阅读 · 0 评论 -
关于C移位操作
在x86_64平台上,下面这段代码输出的结果是否相同?#include <stdint.h>#include <stdio.h>int main(int argc, char* argv[]) { uint32_t k1 = 57; const uint64_t one = 1; uint64_t r0 = one << k...原创 2019-01-24 12:27:07 · 3486 阅读 · 0 评论