### Example commit message format Source: https://github.com/illumos/docs/blob/master/docs/contributing/index.md An example of the required commit message format for illumos, including the issue number, description, and reviewer attribution lines. ```text 123 Description of the issue in our tracker Reviewed by: Jack Reviewed by: Ohana Matsumae ``` -------------------------------- ### Install Build Tools on OpenIndiana (Shell) Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Installs the 'build-essential' package on OpenIndiana, which includes the necessary GCC compilers and other tools required for building illumos. This command requires root privileges. ```shell sudo pkg install build-essential ``` -------------------------------- ### Install Build Dependencies and Compile Illumos (OmniOS) Source: https://context7.com/illumos/docs/llms.txt Installs necessary packages for building Illumos on OmniOS, clones the source repository, configures the build environment by setting key variables, and initiates a full nightly build. It also includes commands for monitoring the build progress and installing the resulting packages. ```bash sudo pkg install pkg:/developer/illumos-tools cd /code git clone https://github.com/illumos/illumos-gate.git cd illumos-gate cp usr/src/tools/env/illumos.sh . vi illumos.sh # Key environment variables to set: # export CODEMGR_WS=/code/illumos-gate # export PKGVERS_BRANCH=9999.99.0.0 # For OpenIndiana # export PRIMARY_CC=gcc10,/opt/gcc-10/bin/gcc,gnu # export SHADOW_CCS=gcc14,/opt/gcc-14/bin/gcc,gnu time ./usr/src/tools/scripts/nightly illumos.sh tail -F /code/illumos-gate/log/nightly.log cat log/latest/mail_msg time ./usr/src/tools/scripts/nightly -i illumos.sh sudo /code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/onu \ -t "$(date -u +nightly-%Y%m%d-%H%MZ)" \ -d "/code/illumos-gate/packages/i386/nightly" reboot ``` -------------------------------- ### Install build packages with onu Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Command to install generated illumos packages using the onu utility. This requires root privileges and specifies the package directory and a unique build environment name. ```bash sudo /code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/onu \ -t "$(date -u +nightly-%Y%m%d-%H%MZ)" \ -d "/code/illumos-gate/packages/i386/nightly" ``` -------------------------------- ### Install MkDocs and Dependencies Source: https://github.com/illumos/docs/blob/master/docs/contributing/docs.md Commands to install the necessary Python packages for local development and testing of the illumos documentation site. These dependencies include the core MkDocs engine, the Material theme, and markdown-include for modular documentation. ```bash pip install mkdocs pip install mkdocs-material pip install markdown-include ``` -------------------------------- ### Install Build Tools on OmniOS (Shell) Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Installs the 'illumos-tools' package on OmniOS, providing all required tools to build illumos. Ensure you are running OmniOS r151028 or higher. This command requires root privileges. ```shell sudo pkg install pkg:/developer/illumos-tools ``` -------------------------------- ### OpenIndiana Specific Build Configuration Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md This section provides shell commands to configure the build environment for OpenIndiana. It includes setting the package version branch and Perl-related environment variables necessary for a complete build with installable packages. ```shell # # Set a package version number which is greater than the current OpenIndiana # build number. # export PKGVERS_BRANCH=9999.99.0.0 # # Set Perl related variables: # PERL='/usr/perl5/bin/perl' export PERL_VERSION="$($PERL -e 'print $^V =~ /^v(5\.[^\.]*).*$/')" export PERL_PKGVERS="$($PERL -e 'print "-", $^V =~ /^v(5)\.([^\.]*).*$/')" export PERL_ARCH="$($PERL -MConfig -e 'print $Config{archname}')" export PERL_ARCH64="$PERL_ARCH" export BUILDPERL32="$($PERL -MConfig -e 'print $Config{ptrsize} == 4 ? "" : "#"')" export BUILDPERL64="$($PERL -MConfig -e 'print $Config{ptrsize} == 8 ? "" : "#"')" ``` -------------------------------- ### Update System Packages (Shell) Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Updates all installed operating system components to their latest versions. This command is essential for ensuring a stable build environment. It requires root privileges. ```shell sudo pkg update ``` -------------------------------- ### Create and Edit Environment File for illumos Build Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md This snippet demonstrates the initial steps to set up the build environment by copying and editing the default environment file template. It involves navigating to the illumos-gate directory, copying the template, and opening it with a text editor. ```shell cd /code/illumos-gate cp usr/src/tools/env/illumos.sh . vi illumos.sh ``` -------------------------------- ### Install Gerrit Commit Message Hook Source: https://github.com/illumos/docs/blob/master/docs/contributing/gerrit.md Explains how to install the Gerrit commit-msg hook script to automatically add a 'Change-Id:' footer to commit messages. This ensures Gerrit can track changes effectively. ```bash $ cd ~/illumos $ scp -O walter@code.illumos.org:hooks/commit-msg .git/hooks/ ``` -------------------------------- ### Configure Firewall Rules with ipfilter Source: https://context7.com/illumos/docs/llms.txt Demonstrates how to configure and manage the ipfilter firewall on Illumos. It includes checking the current firewall status, creating a rules file to allow specific traffic (SSH, HTTP, HTTPS) while blocking others, loading the rules, and enabling the ipfilter service. ```bash # Check current firewall status ipfstat -io # empty list for ipfilter(out) # empty list for ipfilter(in) # Create firewall rules file /etc/ipf/ipf.conf # Allow established connections pass out quick on e1000g0 proto tcp from any to any flags S keep state pass out quick on e1000g0 proto udp from any to any keep state pass out quick on e1000g0 proto icmp from any to any keep state # Allow incoming SSH pass in quick on e1000g0 proto tcp from any to any port = 22 flags S keep state # Allow incoming HTTP/HTTPS pass in quick on e1000g0 proto tcp from any to any port = 80 flags S keep state pass in quick on e1000g0 proto tcp from any to any port = 443 flags S keep state # Block all other incoming traffic block in on e1000g0 all # Load the rules ipf -Fa -f /etc/ipf/ipf.conf # Enable ipfilter service svcadm enable svc:/network/ipfilter:default # View active rules ipfstat -io # pass out quick on e1000g0 proto tcp from any to any flags S keep state # pass in quick on e1000g0 proto tcp from any to any port = ssh flags S keep state ``` -------------------------------- ### View Git Log with Decorations Source: https://github.com/illumos/docs/blob/master/docs/contributing/gerrit.md Demonstrates how to view the Git log with commit decorations, including branches and tags. This is helpful for verifying the state of your local commits before pushing. ```bash $ git log --decorate --graph ``` -------------------------------- ### SSH Connection to Gerrit Source: https://github.com/illumos/docs/blob/master/docs/contributing/gerrit.md Demonstrates how to connect to the Gerrit Code Review service via SSH using provided credentials. This verifies authentication and SSH key setup. ```shell $ ssh walter@code.illumos.org **** Welcome to Gerrit Code Review **** Hi Walter Bishop, you have successfully connected over SSH. ... ``` -------------------------------- ### Clone Illumos Repository and Set Up Git Remotes Source: https://github.com/illumos/docs/blob/master/docs/contributing/gerrit.md Demonstrates how to clone the illumos repository from GitHub and add a Gerrit remote for pushing changes. This involves standard Git commands for cloning and remote management. ```bash $ git clone https://github.com/illumos/illumos-gate.git ~/illumos $ cd ~/illumos $ git remote add illumos walter@code.illumos.org:illumos-gate.git $ git remote -v ``` -------------------------------- ### Monitor build logs Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Commands to track the progress of the build process in real-time. Includes a filtered version to isolate warning and error messages. ```bash tail -F /code/illumos-gate/log/nightly.log ``` ```bash tail -F /code/illumos-gate/log/nightly.log | grep -5 '(error|warning).*: ' ``` -------------------------------- ### Configure and Analyze Application Core Dumps Source: https://context7.com/illumos/docs/llms.txt Manages application core dump behavior using `coreadm` and analyzes core files with `pstack` and `mdb`. It shows how to enable global core dumps to a specified directory and examine the stack trace and registers of a crashed application. ```bash # Check core file configuration coreadm # global core file pattern: # global core file content: default # init core file pattern: core # init core file content: default # global core dumps: disabled # per-process core dumps: enabled # Enable global core dumps to a specific directory coreadm -g /var/cores/core.%f.%p -G default+all -e global # Analyze a core file with pstack pstack core # core 'core' of 1234: /usr/bin/myapp -config /etc/myapp.conf # ----------------- lwp# 1 / thread# 1 -------------------- # feee1234 __systemcall6 (5, 4, 808f678, 1, fe5b0050, fe5b01d0) # feed5678 read (4, 808f678, 1) + 46 # 08051234 process_input (808f678, 1) + 123 # 08050089 main (2, 8047f58, 8047f64) + 89 # 08050010 _start (2, 8047f58, 0, 8047f64, 8047f78, 0) + 10 # Analyze with mdb for more detail mdb core > ::status debugging core file of myapp (32-bit) > ::stack > ::regs > $q ``` -------------------------------- ### DTrace Dynamic Tracing (Bash) Source: https://context7.com/illumos/docs/llms.txt Provides system-wide dynamic tracing of kernel and user-space code with minimal overhead. Supports listing providers, tracing system calls, profiling, and I/O latency analysis using bash commands. ```bash dtrace -l | awk '{print $2}' | sort -u dtrace -n 'syscall:::entry { @[execname] = count(); }' dtrace -n 'syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); }' dtrace -n 'profile-997 /arg0/ { @[stack()] = count(); }' dtrace -n 'io:::start { self->ts = timestamp; } io:::done /self->ts/ @[args[1]->dev_statname] = quantize(timestamp - self->ts); self->ts = 0; }' dtrace -n 'io:::start /args[0]->b_flags & B_WRITE/ @[execname, args[2]->fi_pathname] = sum(args[0]->b_bcount); }' ``` -------------------------------- ### Execute full and incremental illumos builds Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Commands to trigger the nightly build script. Use the standard command for a full build or the -i flag for an incremental build to save time during development. ```bash cd /code/illumos-gate time ./usr/src/tools/scripts/nightly illumos.sh ``` ```bash cd /code/illumos-gate time ./usr/src/tools/scripts/nightly -i illumos.sh ``` -------------------------------- ### Clone illumos Source Code (Shell) Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Clones the illumos source code repository from GitHub using Git. This command requires approximately 6 gigabytes of free space and should be executed in your designated workspace directory. ```shell cd /code git clone https://github.com/illumos/illumos-gate.git ``` -------------------------------- ### Assemble Reviewed-by lines using jq Source: https://github.com/illumos/docs/blob/master/docs/contributing/index.md This snippet demonstrates how to query the Gerrit API to retrieve reviewer information and format it into 'Reviewed by:' lines for a commit message. It uses curl to fetch change details and jq to parse the JSON response for users with a +1 code review label. ```bash curl -s "https://code.illumos.org/changes/$YOUR_CHANGE_NUMBER?o=LABELS&o=DETAILED_ACCOUNTS" | \ tail -n 1 | \ jq -r '.labels."Code-Review".all[] | select(.value==1) | "Reviewed by: \(.name) <\(.email)>"' ``` -------------------------------- ### ZFS Dataset Operations (Bash) Source: https://context7.com/illumos/docs/llms.txt Performs operations on ZFS datasets, including creation with compression, snapshotting, cloning, sending/receiving for backup, rollback, and destruction. Utilizes bash for ZFS commands. ```bash zfs create -o compression=lz4 tank/data zfs create tank/data/projects zfs snapshot tank/data@monday zfs list -t snapshot zfs clone tank/data@monday tank/data-clone zfs send tank/data@monday > /backup/data-monday.zfs zfs send tank/data@monday | ssh backuphost zfs receive tank/data zfs rollback tank/data@monday zfs destroy tank/data@monday ``` -------------------------------- ### Download and Extract Closed Binaries (Shell) Source: https://github.com/illumos/docs/blob/master/docs/developers/build.md Downloads and extracts necessary closed binary files for illumos development when they are not included with the distribution's development tools. This involves using wget to download tarballs and then tar to extract them. ```shell cd /code/illumos-gate wget -c \ https://download.smartos.org/pub/build/illumos/on-closed-bins.i386.tar.bz2 \ https://download.smartos.org/pub/build/illumos/on-closed-bins-nd.i386.tar.bz2 tar xjvpf on-closed-bins.i386.tar.bz2 tar xjvpf on-closed-bins-nd.i386.tar.bz2 ``` -------------------------------- ### Analyze System Crash Dumps with mdb Source: https://context7.com/illumos/docs/llms.txt Configures and extracts system crash dumps for post-mortem analysis using the mdb debugger. It covers checking dump configuration, saving core dumps, and analyzing them with mdb commands to inspect panic information, CPU state, threads, and call stacks. ```bash # Check crash dump configuration pfexec dumpadm # Dump content: kernel pages # Dump device: /dev/zvol/dsk/rpool/dump (dedicated) # Savecore directory: /var/crash/kirin # Savecore enabled: no # Save compressed: on # Extract crash dump from dump device pfexec mkdir -p /var/crash/`hostname` pfexec savecore cd /var/crash/`hostname` pfexec savecore -vf vmdump.0 # Analyze crash dump with mdb echo '::panicinfo ::cpuinfo -v ::threadlist -v 10 ::msgbuf *panic_thread::findstack -v ::stacks' | mdb 0 > ~/crash.0 # Enable kernel debugger on boot (add to GRUB kernel line) # -kvd -m verbose # In kmdb, enable module debugging kmdb> moddebug/W 80000000 kmdb> snooping/W 1 kmdb> :c # Force a crash dump from kmdb kmdb> $