diff --git a/lab2/.clang-format b/lab2/.clang-format new file mode 100644 index 000000000..ccc9b9397 --- /dev/null +++ b/lab2/.clang-format @@ -0,0 +1,743 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# clang-format configuration file. Intended for clang-format >= 11. +# +# For more information, see: +# +# Documentation/process/clang-format.rst +# https://clang.llvm.org/docs/ClangFormat.html +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# +--- +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false + +# Taken from: +# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \ +# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ +# | LC_ALL=C sort -u +ForEachMacros: + - '__ata_qc_for_each' + - '__bio_for_each_bvec' + - '__bio_for_each_segment' + - '__evlist__for_each_entry' + - '__evlist__for_each_entry_continue' + - '__evlist__for_each_entry_from' + - '__evlist__for_each_entry_reverse' + - '__evlist__for_each_entry_safe' + - '__for_each_mem_range' + - '__for_each_mem_range_rev' + - '__for_each_thread' + - '__hlist_for_each_rcu' + - '__map__for_each_symbol_by_name' + - '__pci_bus_for_each_res0' + - '__pci_bus_for_each_res1' + - '__pci_dev_for_each_res0' + - '__pci_dev_for_each_res1' + - '__perf_evlist__for_each_entry' + - '__perf_evlist__for_each_entry_reverse' + - '__perf_evlist__for_each_entry_safe' + - '__rq_for_each_bio' + - '__shost_for_each_device' + - '__sym_for_each' + - 'apei_estatus_for_each_section' + - 'ata_for_each_dev' + - 'ata_for_each_link' + - 'ata_qc_for_each' + - 'ata_qc_for_each_raw' + - 'ata_qc_for_each_with_internal' + - 'ax25_for_each' + - 'ax25_uid_for_each' + - 'bio_for_each_bvec' + - 'bio_for_each_bvec_all' + - 'bio_for_each_folio_all' + - 'bio_for_each_integrity_vec' + - 'bio_for_each_segment' + - 'bio_for_each_segment_all' + - 'bio_list_for_each' + - 'bip_for_each_vec' + - 'bond_for_each_slave' + - 'bond_for_each_slave_rcu' + - 'bpf_for_each' + - 'bpf_for_each_reg_in_vstate' + - 'bpf_for_each_reg_in_vstate_mask' + - 'bpf_for_each_spilled_reg' + - 'bpf_object__for_each_map' + - 'bpf_object__for_each_program' + - 'btree_for_each_safe128' + - 'btree_for_each_safe32' + - 'btree_for_each_safe64' + - 'btree_for_each_safel' + - 'card_for_each_dev' + - 'cgroup_taskset_for_each' + - 'cgroup_taskset_for_each_leader' + - 'cpu_aggr_map__for_each_idx' + - 'cpufreq_for_each_efficient_entry_idx' + - 'cpufreq_for_each_entry' + - 'cpufreq_for_each_entry_idx' + - 'cpufreq_for_each_valid_entry' + - 'cpufreq_for_each_valid_entry_idx' + - 'css_for_each_child' + - 'css_for_each_descendant_post' + - 'css_for_each_descendant_pre' + - 'damon_for_each_region' + - 'damon_for_each_region_from' + - 'damon_for_each_region_safe' + - 'damon_for_each_scheme' + - 'damon_for_each_scheme_safe' + - 'damon_for_each_target' + - 'damon_for_each_target_safe' + - 'damos_for_each_filter' + - 'damos_for_each_filter_safe' + - 'data__for_each_file' + - 'data__for_each_file_new' + - 'data__for_each_file_start' + - 'device_for_each_child_node' + - 'displayid_iter_for_each' + - 'dma_fence_array_for_each' + - 'dma_fence_chain_for_each' + - 'dma_fence_unwrap_for_each' + - 'dma_resv_for_each_fence' + - 'dma_resv_for_each_fence_unlocked' + - 'do_for_each_ftrace_op' + - 'drm_atomic_crtc_for_each_plane' + - 'drm_atomic_crtc_state_for_each_plane' + - 'drm_atomic_crtc_state_for_each_plane_state' + - 'drm_atomic_for_each_plane_damage' + - 'drm_client_for_each_connector_iter' + - 'drm_client_for_each_modeset' + - 'drm_connector_for_each_possible_encoder' + - 'drm_exec_for_each_locked_object' + - 'drm_exec_for_each_locked_object_reverse' + - 'drm_for_each_bridge_in_chain' + - 'drm_for_each_connector_iter' + - 'drm_for_each_crtc' + - 'drm_for_each_crtc_reverse' + - 'drm_for_each_encoder' + - 'drm_for_each_encoder_mask' + - 'drm_for_each_fb' + - 'drm_for_each_legacy_plane' + - 'drm_for_each_plane' + - 'drm_for_each_plane_mask' + - 'drm_for_each_privobj' + - 'drm_gem_for_each_gpuva' + - 'drm_gem_for_each_gpuva_safe' + - 'drm_gpuva_for_each_op' + - 'drm_gpuva_for_each_op_from_reverse' + - 'drm_gpuva_for_each_op_safe' + - 'drm_gpuvm_for_each_va' + - 'drm_gpuvm_for_each_va_range' + - 'drm_gpuvm_for_each_va_range_safe' + - 'drm_gpuvm_for_each_va_safe' + - 'drm_mm_for_each_hole' + - 'drm_mm_for_each_node' + - 'drm_mm_for_each_node_in_range' + - 'drm_mm_for_each_node_safe' + - 'dsa_switch_for_each_available_port' + - 'dsa_switch_for_each_cpu_port' + - 'dsa_switch_for_each_cpu_port_continue_reverse' + - 'dsa_switch_for_each_port' + - 'dsa_switch_for_each_port_continue_reverse' + - 'dsa_switch_for_each_port_safe' + - 'dsa_switch_for_each_user_port' + - 'dsa_tree_for_each_cpu_port' + - 'dsa_tree_for_each_user_port' + - 'dsa_tree_for_each_user_port_continue_reverse' + - 'dso__for_each_symbol' + - 'dsos__for_each_with_build_id' + - 'elf_hash_for_each_possible' + - 'elf_symtab__for_each_symbol' + - 'evlist__for_each_cpu' + - 'evlist__for_each_entry' + - 'evlist__for_each_entry_continue' + - 'evlist__for_each_entry_from' + - 'evlist__for_each_entry_reverse' + - 'evlist__for_each_entry_safe' + - 'flow_action_for_each' + - 'for_each_acpi_consumer_dev' + - 'for_each_acpi_dev_match' + - 'for_each_active_dev_scope' + - 'for_each_active_drhd_unit' + - 'for_each_active_iommu' + - 'for_each_active_route' + - 'for_each_aggr_pgid' + - 'for_each_and_bit' + - 'for_each_andnot_bit' + - 'for_each_available_child_of_node' + - 'for_each_bench' + - 'for_each_bio' + - 'for_each_board_func_rsrc' + - 'for_each_btf_ext_rec' + - 'for_each_btf_ext_sec' + - 'for_each_bvec' + - 'for_each_card_auxs' + - 'for_each_card_auxs_safe' + - 'for_each_card_components' + - 'for_each_card_dapms' + - 'for_each_card_pre_auxs' + - 'for_each_card_prelinks' + - 'for_each_card_rtds' + - 'for_each_card_rtds_safe' + - 'for_each_card_widgets' + - 'for_each_card_widgets_safe' + - 'for_each_cgroup_storage_type' + - 'for_each_child_of_node' + - 'for_each_clear_bit' + - 'for_each_clear_bit_from' + - 'for_each_clear_bitrange' + - 'for_each_clear_bitrange_from' + - 'for_each_cmd' + - 'for_each_cmsghdr' + - 'for_each_collection' + - 'for_each_comp_order' + - 'for_each_compatible_node' + - 'for_each_component_dais' + - 'for_each_component_dais_safe' + - 'for_each_conduit' + - 'for_each_console' + - 'for_each_console_srcu' + - 'for_each_cpu' + - 'for_each_cpu_and' + - 'for_each_cpu_andnot' + - 'for_each_cpu_or' + - 'for_each_cpu_wrap' + - 'for_each_dapm_widgets' + - 'for_each_dedup_cand' + - 'for_each_dev_addr' + - 'for_each_dev_scope' + - 'for_each_dma_cap_mask' + - 'for_each_dpcm_be' + - 'for_each_dpcm_be_rollback' + - 'for_each_dpcm_be_safe' + - 'for_each_dpcm_fe' + - 'for_each_drhd_unit' + - 'for_each_dss_dev' + - 'for_each_efi_memory_desc' + - 'for_each_efi_memory_desc_in_map' + - 'for_each_element' + - 'for_each_element_extid' + - 'for_each_element_id' + - 'for_each_endpoint_of_node' + - 'for_each_event' + - 'for_each_event_tps' + - 'for_each_evictable_lru' + - 'for_each_fib6_node_rt_rcu' + - 'for_each_fib6_walker_rt' + - 'for_each_free_mem_pfn_range_in_zone' + - 'for_each_free_mem_pfn_range_in_zone_from' + - 'for_each_free_mem_range' + - 'for_each_free_mem_range_reverse' + - 'for_each_func_rsrc' + - 'for_each_gpiochip_node' + - 'for_each_group_evsel' + - 'for_each_group_evsel_head' + - 'for_each_group_member' + - 'for_each_group_member_head' + - 'for_each_hstate' + - 'for_each_if' + - 'for_each_inject_fn' + - 'for_each_insn' + - 'for_each_insn_prefix' + - 'for_each_intid' + - 'for_each_iommu' + - 'for_each_ip_tunnel_rcu' + - 'for_each_irq_nr' + - 'for_each_lang' + - 'for_each_link_codecs' + - 'for_each_link_cpus' + - 'for_each_link_platforms' + - 'for_each_lru' + - 'for_each_matching_node' + - 'for_each_matching_node_and_match' + - 'for_each_media_entity_data_link' + - 'for_each_mem_pfn_range' + - 'for_each_mem_range' + - 'for_each_mem_range_rev' + - 'for_each_mem_region' + - 'for_each_member' + - 'for_each_memory' + - 'for_each_migratetype_order' + - 'for_each_missing_reg' + - 'for_each_mle_subelement' + - 'for_each_mod_mem_type' + - 'for_each_net' + - 'for_each_net_continue_reverse' + - 'for_each_net_rcu' + - 'for_each_netdev' + - 'for_each_netdev_continue' + - 'for_each_netdev_continue_rcu' + - 'for_each_netdev_continue_reverse' + - 'for_each_netdev_dump' + - 'for_each_netdev_feature' + - 'for_each_netdev_in_bond_rcu' + - 'for_each_netdev_rcu' + - 'for_each_netdev_reverse' + - 'for_each_netdev_safe' + - 'for_each_new_connector_in_state' + - 'for_each_new_crtc_in_state' + - 'for_each_new_mst_mgr_in_state' + - 'for_each_new_plane_in_state' + - 'for_each_new_plane_in_state_reverse' + - 'for_each_new_private_obj_in_state' + - 'for_each_new_reg' + - 'for_each_node' + - 'for_each_node_by_name' + - 'for_each_node_by_type' + - 'for_each_node_mask' + - 'for_each_node_state' + - 'for_each_node_with_cpus' + - 'for_each_node_with_property' + - 'for_each_nonreserved_multicast_dest_pgid' + - 'for_each_numa_hop_mask' + - 'for_each_of_allnodes' + - 'for_each_of_allnodes_from' + - 'for_each_of_cpu_node' + - 'for_each_of_pci_range' + - 'for_each_old_connector_in_state' + - 'for_each_old_crtc_in_state' + - 'for_each_old_mst_mgr_in_state' + - 'for_each_old_plane_in_state' + - 'for_each_old_private_obj_in_state' + - 'for_each_oldnew_connector_in_state' + - 'for_each_oldnew_crtc_in_state' + - 'for_each_oldnew_mst_mgr_in_state' + - 'for_each_oldnew_plane_in_state' + - 'for_each_oldnew_plane_in_state_reverse' + - 'for_each_oldnew_private_obj_in_state' + - 'for_each_online_cpu' + - 'for_each_online_node' + - 'for_each_online_pgdat' + - 'for_each_or_bit' + - 'for_each_path' + - 'for_each_pci_bridge' + - 'for_each_pci_dev' + - 'for_each_pcm_streams' + - 'for_each_physmem_range' + - 'for_each_populated_zone' + - 'for_each_possible_cpu' + - 'for_each_present_blessed_reg' + - 'for_each_present_cpu' + - 'for_each_prime_number' + - 'for_each_prime_number_from' + - 'for_each_probe_cache_entry' + - 'for_each_process' + - 'for_each_process_thread' + - 'for_each_prop_codec_conf' + - 'for_each_prop_dai_codec' + - 'for_each_prop_dai_cpu' + - 'for_each_prop_dlc_codecs' + - 'for_each_prop_dlc_cpus' + - 'for_each_prop_dlc_platforms' + - 'for_each_property_of_node' + - 'for_each_reg' + - 'for_each_reg_filtered' + - 'for_each_reloc' + - 'for_each_reloc_from' + - 'for_each_requested_gpio' + - 'for_each_requested_gpio_in_range' + - 'for_each_reserved_mem_range' + - 'for_each_reserved_mem_region' + - 'for_each_rtd_codec_dais' + - 'for_each_rtd_components' + - 'for_each_rtd_cpu_dais' + - 'for_each_rtd_dais' + - 'for_each_sband_iftype_data' + - 'for_each_script' + - 'for_each_sec' + - 'for_each_set_bit' + - 'for_each_set_bit_from' + - 'for_each_set_bit_wrap' + - 'for_each_set_bitrange' + - 'for_each_set_bitrange_from' + - 'for_each_set_clump8' + - 'for_each_sg' + - 'for_each_sg_dma_page' + - 'for_each_sg_page' + - 'for_each_sgtable_dma_page' + - 'for_each_sgtable_dma_sg' + - 'for_each_sgtable_page' + - 'for_each_sgtable_sg' + - 'for_each_sibling_event' + - 'for_each_sta_active_link' + - 'for_each_subelement' + - 'for_each_subelement_extid' + - 'for_each_subelement_id' + - 'for_each_sublist' + - 'for_each_subsystem' + - 'for_each_supported_activate_fn' + - 'for_each_supported_inject_fn' + - 'for_each_sym' + - 'for_each_test' + - 'for_each_thread' + - 'for_each_token' + - 'for_each_unicast_dest_pgid' + - 'for_each_valid_link' + - 'for_each_vif_active_link' + - 'for_each_vma' + - 'for_each_vma_range' + - 'for_each_vsi' + - 'for_each_wakeup_source' + - 'for_each_zone' + - 'for_each_zone_zonelist' + - 'for_each_zone_zonelist_nodemask' + - 'func_for_each_insn' + - 'fwnode_for_each_available_child_node' + - 'fwnode_for_each_child_node' + - 'fwnode_for_each_parent_node' + - 'fwnode_graph_for_each_endpoint' + - 'gadget_for_each_ep' + - 'genradix_for_each' + - 'genradix_for_each_from' + - 'genradix_for_each_reverse' + - 'hash_for_each' + - 'hash_for_each_possible' + - 'hash_for_each_possible_rcu' + - 'hash_for_each_possible_rcu_notrace' + - 'hash_for_each_possible_safe' + - 'hash_for_each_rcu' + - 'hash_for_each_safe' + - 'hashmap__for_each_entry' + - 'hashmap__for_each_entry_safe' + - 'hashmap__for_each_key_entry' + - 'hashmap__for_each_key_entry_safe' + - 'hctx_for_each_ctx' + - 'hists__for_each_format' + - 'hists__for_each_sort_list' + - 'hlist_bl_for_each_entry' + - 'hlist_bl_for_each_entry_rcu' + - 'hlist_bl_for_each_entry_safe' + - 'hlist_for_each' + - 'hlist_for_each_entry' + - 'hlist_for_each_entry_continue' + - 'hlist_for_each_entry_continue_rcu' + - 'hlist_for_each_entry_continue_rcu_bh' + - 'hlist_for_each_entry_from' + - 'hlist_for_each_entry_from_rcu' + - 'hlist_for_each_entry_rcu' + - 'hlist_for_each_entry_rcu_bh' + - 'hlist_for_each_entry_rcu_notrace' + - 'hlist_for_each_entry_safe' + - 'hlist_for_each_entry_srcu' + - 'hlist_for_each_safe' + - 'hlist_nulls_for_each_entry' + - 'hlist_nulls_for_each_entry_from' + - 'hlist_nulls_for_each_entry_rcu' + - 'hlist_nulls_for_each_entry_safe' + - 'i3c_bus_for_each_i2cdev' + - 'i3c_bus_for_each_i3cdev' + - 'idr_for_each_entry' + - 'idr_for_each_entry_continue' + - 'idr_for_each_entry_continue_ul' + - 'idr_for_each_entry_ul' + - 'in_dev_for_each_ifa_rcu' + - 'in_dev_for_each_ifa_rtnl' + - 'inet_bind_bucket_for_each' + - 'interval_tree_for_each_span' + - 'intlist__for_each_entry' + - 'intlist__for_each_entry_safe' + - 'kcore_copy__for_each_phdr' + - 'key_for_each' + - 'key_for_each_safe' + - 'klp_for_each_func' + - 'klp_for_each_func_safe' + - 'klp_for_each_func_static' + - 'klp_for_each_object' + - 'klp_for_each_object_safe' + - 'klp_for_each_object_static' + - 'kunit_suite_for_each_test_case' + - 'kvm_for_each_memslot' + - 'kvm_for_each_memslot_in_gfn_range' + - 'kvm_for_each_vcpu' + - 'libbpf_nla_for_each_attr' + - 'list_for_each' + - 'list_for_each_codec' + - 'list_for_each_codec_safe' + - 'list_for_each_continue' + - 'list_for_each_entry' + - 'list_for_each_entry_continue' + - 'list_for_each_entry_continue_rcu' + - 'list_for_each_entry_continue_reverse' + - 'list_for_each_entry_from' + - 'list_for_each_entry_from_rcu' + - 'list_for_each_entry_from_reverse' + - 'list_for_each_entry_lockless' + - 'list_for_each_entry_rcu' + - 'list_for_each_entry_reverse' + - 'list_for_each_entry_safe' + - 'list_for_each_entry_safe_continue' + - 'list_for_each_entry_safe_from' + - 'list_for_each_entry_safe_reverse' + - 'list_for_each_entry_srcu' + - 'list_for_each_from' + - 'list_for_each_prev' + - 'list_for_each_prev_safe' + - 'list_for_each_rcu' + - 'list_for_each_reverse' + - 'list_for_each_safe' + - 'llist_for_each' + - 'llist_for_each_entry' + - 'llist_for_each_entry_safe' + - 'llist_for_each_safe' + - 'lwq_for_each_safe' + - 'map__for_each_symbol' + - 'map__for_each_symbol_by_name' + - 'maps__for_each_entry' + - 'maps__for_each_entry_safe' + - 'mas_for_each' + - 'mci_for_each_dimm' + - 'media_device_for_each_entity' + - 'media_device_for_each_intf' + - 'media_device_for_each_link' + - 'media_device_for_each_pad' + - 'media_entity_for_each_pad' + - 'media_pipeline_for_each_entity' + - 'media_pipeline_for_each_pad' + - 'mlx5_lag_for_each_peer_mdev' + - 'msi_domain_for_each_desc' + - 'msi_for_each_desc' + - 'mt_for_each' + - 'nanddev_io_for_each_page' + - 'netdev_for_each_lower_dev' + - 'netdev_for_each_lower_private' + - 'netdev_for_each_lower_private_rcu' + - 'netdev_for_each_mc_addr' + - 'netdev_for_each_synced_mc_addr' + - 'netdev_for_each_synced_uc_addr' + - 'netdev_for_each_uc_addr' + - 'netdev_for_each_upper_dev_rcu' + - 'netdev_hw_addr_list_for_each' + - 'nft_rule_for_each_expr' + - 'nla_for_each_attr' + - 'nla_for_each_nested' + - 'nlmsg_for_each_attr' + - 'nlmsg_for_each_msg' + - 'nr_neigh_for_each' + - 'nr_neigh_for_each_safe' + - 'nr_node_for_each' + - 'nr_node_for_each_safe' + - 'of_for_each_phandle' + - 'of_property_for_each_string' + - 'of_property_for_each_u32' + - 'pci_bus_for_each_resource' + - 'pci_dev_for_each_resource' + - 'pcl_for_each_chunk' + - 'pcl_for_each_segment' + - 'pcm_for_each_format' + - 'perf_config_items__for_each_entry' + - 'perf_config_sections__for_each_entry' + - 'perf_config_set__for_each_entry' + - 'perf_cpu_map__for_each_cpu' + - 'perf_cpu_map__for_each_idx' + - 'perf_evlist__for_each_entry' + - 'perf_evlist__for_each_entry_reverse' + - 'perf_evlist__for_each_entry_safe' + - 'perf_evlist__for_each_evsel' + - 'perf_evlist__for_each_mmap' + - 'perf_hpp_list__for_each_format' + - 'perf_hpp_list__for_each_format_safe' + - 'perf_hpp_list__for_each_sort_list' + - 'perf_hpp_list__for_each_sort_list_safe' + - 'perf_tool_event__for_each_event' + - 'plist_for_each' + - 'plist_for_each_continue' + - 'plist_for_each_entry' + - 'plist_for_each_entry_continue' + - 'plist_for_each_entry_safe' + - 'plist_for_each_safe' + - 'pnp_for_each_card' + - 'pnp_for_each_dev' + - 'protocol_for_each_card' + - 'protocol_for_each_dev' + - 'queue_for_each_hw_ctx' + - 'radix_tree_for_each_slot' + - 'radix_tree_for_each_tagged' + - 'rb_for_each' + - 'rbtree_postorder_for_each_entry_safe' + - 'rdma_for_each_block' + - 'rdma_for_each_port' + - 'rdma_umem_for_each_dma_block' + - 'resort_rb__for_each_entry' + - 'resource_list_for_each_entry' + - 'resource_list_for_each_entry_safe' + - 'rhl_for_each_entry_rcu' + - 'rhl_for_each_rcu' + - 'rht_for_each' + - 'rht_for_each_entry' + - 'rht_for_each_entry_from' + - 'rht_for_each_entry_rcu' + - 'rht_for_each_entry_rcu_from' + - 'rht_for_each_entry_safe' + - 'rht_for_each_from' + - 'rht_for_each_rcu' + - 'rht_for_each_rcu_from' + - 'rq_for_each_bvec' + - 'rq_for_each_segment' + - 'rq_list_for_each' + - 'rq_list_for_each_safe' + - 'sample_read_group__for_each' + - 'scsi_for_each_prot_sg' + - 'scsi_for_each_sg' + - 'sctp_for_each_hentry' + - 'sctp_skb_for_each' + - 'sec_for_each_insn' + - 'sec_for_each_insn_continue' + - 'sec_for_each_insn_from' + - 'sec_for_each_sym' + - 'shdma_for_each_chan' + - 'shost_for_each_device' + - 'sk_for_each' + - 'sk_for_each_bound' + - 'sk_for_each_bound_bhash2' + - 'sk_for_each_entry_offset_rcu' + - 'sk_for_each_from' + - 'sk_for_each_rcu' + - 'sk_for_each_safe' + - 'sk_nulls_for_each' + - 'sk_nulls_for_each_from' + - 'sk_nulls_for_each_rcu' + - 'snd_array_for_each' + - 'snd_pcm_group_for_each_entry' + - 'snd_soc_dapm_widget_for_each_path' + - 'snd_soc_dapm_widget_for_each_path_safe' + - 'snd_soc_dapm_widget_for_each_sink_path' + - 'snd_soc_dapm_widget_for_each_source_path' + - 'strlist__for_each_entry' + - 'strlist__for_each_entry_safe' + - 'sym_for_each_insn' + - 'sym_for_each_insn_continue_reverse' + - 'symbols__for_each_entry' + - 'tb_property_for_each' + - 'tcf_act_for_each_action' + - 'tcf_exts_for_each_action' + - 'ttm_resource_manager_for_each_res' + - 'twsk_for_each_bound_bhash2' + - 'udp_portaddr_for_each_entry' + - 'udp_portaddr_for_each_entry_rcu' + - 'usb_hub_for_each_child' + - 'v4l2_device_for_each_subdev' + - 'v4l2_m2m_for_each_dst_buf' + - 'v4l2_m2m_for_each_dst_buf_safe' + - 'v4l2_m2m_for_each_src_buf' + - 'v4l2_m2m_for_each_src_buf_safe' + - 'virtio_device_for_each_vq' + - 'while_for_each_ftrace_op' + - 'xa_for_each' + - 'xa_for_each_marked' + - 'xa_for_each_range' + - 'xa_for_each_start' + - 'xas_for_each' + - 'xas_for_each_conflict' + - 'xas_for_each_marked' + - 'xbc_array_for_each_value' + - 'xbc_for_each_key_value' + - 'xbc_node_for_each_array_value' + - 'xbc_node_for_each_child' + - 'xbc_node_for_each_key_value' + - 'xbc_node_for_each_subkey' + - 'zorro_for_each_dev' + +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 8 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true + +# Taken from git's rules +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 8 +UseTab: Always +... diff --git a/lab2/bootloader/Makefile b/lab2/bootloader/Makefile new file mode 100644 index 000000000..aa1f2eda5 --- /dev/null +++ b/lab2/bootloader/Makefile @@ -0,0 +1,36 @@ +CC = aarch64-linux-gnu-gcc +LD = aarch64-linux-gnu-ld +AR = aarch64-linux-gnu-ar +OBJCOPY = aarch64-linux-gnu-objcopy +LINKER_SCRIPT = linker.ld +START = start +IMG_NAME = bootloader +BUILD = ../build + +CFLAGS := -fno-stack-protector -I ../include/ + +all: $(BUILD)/$(IMG_NAME).img + +$(BUILD)/$(START).o: $(START).S + $(CC) $(CFLAGS) -c $(START).S -o $(BUILD)/$(START).o + +OBJS := \ + bootloader.o \ + uart.o \ + string.o + + +OBJS := $(addprefix $(BUILD)/, $(OBJS)) + +$(BUILD)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILD)/$(IMG_NAME).img: $(BUILD)/$(START).o $(OBJS) + $(LD) $(BUILD)/$(START).o $(OBJS) -T $(LINKER_SCRIPT) -o $(BUILD)/$(IMG_NAME).elf + $(OBJCOPY) -O binary $(BUILD)/$(IMG_NAME).elf $(BUILD)/$(IMG_NAME).img + +clean: + rm -f $(BUILD)/$(IMG_NAME).elf $(BUILD)/$(IMG_NAME).img $(BUILD)/*.o + +run: + qemu-system-aarch64 -M raspi3b -kernel $(BUILD)/$(IMG_NAME).img -serial null -serial stdio diff --git a/lab2/bootloader/bootloader.c b/lab2/bootloader/bootloader.c new file mode 100644 index 000000000..aed17eebc --- /dev/null +++ b/lab2/bootloader/bootloader.c @@ -0,0 +1,69 @@ +#include + +#include "uart.h" +#include "string.h" + +#define MAX_BUFFER_LEN 1024 + +void bootloader_main(void *dtb) +{ + char buffer[MAX_BUFFER_LEN]; + size_t buffer_index = 0; + char ch; + + uart_init(); + uart_puts("Starting the shell!\r\n"); + + while (1) { + uart_puts("# "); + buffer_index = 0; + buffer[0] = '\0'; + + while (1) { + ch = uart_getc(); + if (buffer_index + 1 >= sizeof(buffer)) { + uart_puts( + "ERROR: Exceed buffer length limit!\r\n"); + buffer_index = 0; + buffer[0] = '\0'; + break; + } + if (ch == '\n') { + uart_puts("\r\n"); + buffer[buffer_index] = '\0'; + break; + } + uart_send(ch); + buffer[buffer_index++] = ch; + } + // dispatch_cmd(buffer); + + if (strcmp(buffer, "boot") == 0) { + unsigned int size = 0; + unsigned char *size_buffer = (unsigned char *)&size; + + uart_puts("Use send_loader.py to load kernel\r\n"); + for (int i = 0; i < 4; i++) + size_buffer[i] = uart_getc(); + uart_puts("Start receiving kernel\r\n"); + + char *kernel = (char *)0x80000; // load kernel in 0x80000 + while (size--) + *kernel++ = uart_getc(); + + uart_puts("kernel loaded!\r\n"); + + void (*kernel_entry)(void) = (void (*)(void))0x80000; + kernel_entry(); + + return; + } else { + uart_puts("ERROR: Unrecognized command!\r\n"); + } + } + + // echo everything back + while (1) { + uart_send(uart_getc()); + } +} diff --git a/lab2/bootloader/config.txt b/lab2/bootloader/config.txt new file mode 100644 index 000000000..49fc25695 --- /dev/null +++ b/lab2/bootloader/config.txt @@ -0,0 +1,3 @@ +kernel=bootloader.img +arm_64bit=1 +initramfs initramfs.cpio 0x20000000 diff --git a/lab2/bootloader/linker.ld b/lab2/bootloader/linker.ld new file mode 100644 index 000000000..d903ec733 --- /dev/null +++ b/lab2/bootloader/linker.ld @@ -0,0 +1,22 @@ +SECTIONS +{ + . = 0x60000; /*start loading from 0x60000*/ + + .text : { KEEP(*(.text.boot)) *(.text .text.* .gnu.linkonce.t*) } + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r*) } + PROVIDE(_data = .); /* let _data = current address */ + .data : { *(.data .data.* .gnu.linkonce.d*) } + .bss (NOLOAD) : { /*don't require space in executable*/ + . = ALIGN(16); /*align with 16 bit for efficiency*/ + /*put all .bss, .bss. segments and other segments into .bss */ + __bss_start = .; + *(.bss .bss.*) + *(COMMON) + __bss_end = .; + } + _end = .; + + /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) } +} +__bss_size = (__bss_end - __bss_start)>>3; /* bss size for start.S */ +__bootloader_size = (_end - 0x60000)>>3; diff --git a/lab2/bootloader/send_loader.py b/lab2/bootloader/send_loader.py new file mode 100644 index 000000000..83702004f --- /dev/null +++ b/lab2/bootloader/send_loader.py @@ -0,0 +1,31 @@ +import os +import os.path +import argparse +import time + +# Set up argument parser +parser = argparse.ArgumentParser(description='Send a file over serial connection.') +parser.add_argument('-s', '--serial_path', default='/dev/ttyUSB0', help='The path to the serial device (default: /dev/ttyUSB0)') +parser.add_argument('-f', '--file_path', default='kernel8.img', help='The file to send (default: kernel8.img)') +args = parser.parse_args() + +# Check if file exists +if not os.path.exists(args.file_path): + print(f"File {args.file_path} not found.") + exit(1) + +# Get file size +size = os.stat(args.file_path).st_size +size_bytes = size.to_bytes(4, "little") #little endian to fit the environment (8bit 8bit 8bit 8bit) + +# Open serial connection write binary +with open(args.serial_path, "wb", buffering=0) as tty: + # Send file size + tty.write(size_bytes) + print("wrote data") + time.sleep(3) + print("sending kernel") + + # Open and send the file + with open(args.file_path, "rb") as f: + tty.write(f.read()) diff --git a/lab2/bootloader/start.S b/lab2/bootloader/start.S new file mode 100644 index 000000000..2a1df108e --- /dev/null +++ b/lab2/bootloader/start.S @@ -0,0 +1,48 @@ +.section ".text.boot" + +.global _start + +_start: + // relocate bootloader + mov x28, x0 + ldr x1, =0x80000 //64 bits for address, 0x1 = 1 byte + ldr x2, =0x60000 //ldr: put address to register + ldr w3, =__bootloader_size //size, 32 bit is enough + +relocate: //since its 64-bit architecture, move 8 bytes every time + ldr x4,[x1],#8 //store value from x1 to x4, then mov x1 ([] means read value in the address) + str x4,[x2],#8 //store value from x4 to x2, then mov x2 ([] means write value in the address) + sub w3,w3,#1 //size is >>3, so 1 means 8 bytes + cbnz w3,relocate //keep relocate if size is not 0 + +init_cpu: + // read cpu id, stop slave cores + mrs x1, mpidr_el1 //get cpu num + and x1, x1, #3 //see if cpu num is 0 + cbz x1, 2f //cpu 0 jump to 2f (others wfe) + // cpu id > 0, stop + +1: wfe + b 1b + +2: // cpu id == 0 + + // set top of stack just before our code (stack grows to a lower address per AAPCS64) + ldr x1, =_start //ldr: load Register + mov sp, x1 //stack pointer before _start + + // clear bss + ldr x1, =__bss_start + ldr w2, =__bss_size + +3: cbz w2, 4f //see if bss is cleared, if cleared go to 4 + str xzr, [x1], #8 //xzr means zero, clear to zzero from start + sub w2, w2, #1 //1 count means 8bit + cbnz w2, 3b //if not zero go back + + // jump to C code, should not return + +4: mov x0, x28 + bl bootloader_main-0x20000 + // for failsafe, halt this core too + b 1b diff --git a/lab2/build.sh b/lab2/build.sh new file mode 100755 index 000000000..582d50a49 --- /dev/null +++ b/lab2/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +rm ./build/* +cd kernel +make +cd .. +rm ./build/start.o +cd bootloader +make diff --git a/lab2/include/cpio.h b/lab2/include/cpio.h new file mode 100644 index 000000000..498ac2fda --- /dev/null +++ b/lab2/include/cpio.h @@ -0,0 +1,25 @@ +#pragma once + +struct cpio_newc_header { + //file metadata + char c_magic[6]; // Magic number identifying the CPIO format + char c_ino[8]; // Inode number + char c_mode[8]; // File mode and type + char c_uid[8]; // User ID of file owner + char c_gid[8]; // Group ID of file owner + char c_nlink[8]; // Number of hard links + char c_mtime[8]; // Modification time of file + char c_filesize[8]; // Size of file (in hexadecimal) + char c_devmajor[8]; // Major device number (for device files) + char c_devminor[8]; // Minor device number (for device files) + char c_rdevmajor + [8]; // Major device number for the device file node referenced by the symlink + char c_rdevminor + [8]; // Minor device number for the device file node referenced by the symlink + char c_namesize[8]; // Size of filename (in hexadecimal) + char c_check[8]; // Checksum +}; +// Link: https://manpages.ubuntu.com/manpages/bionic/man5/cpio.5.html + +void cpio_ls(); +void cpio_cat(); diff --git a/lab2/include/gpio.h b/lab2/include/gpio.h new file mode 100644 index 000000000..a86df0de7 --- /dev/null +++ b/lab2/include/gpio.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#define MMIO_BASE 0x3F000000 + +#define GPFSEL0 ((volatile unsigned int *)(MMIO_BASE + 0x00200000)) +#define GPFSEL1 ((volatile unsigned int *)(MMIO_BASE + 0x00200004)) +#define GPFSEL2 ((volatile unsigned int *)(MMIO_BASE + 0x00200008)) +#define GPFSEL3 ((volatile unsigned int *)(MMIO_BASE + 0x0020000C)) +#define GPFSEL4 ((volatile unsigned int *)(MMIO_BASE + 0x00200010)) +#define GPFSEL5 ((volatile unsigned int *)(MMIO_BASE + 0x00200014)) +#define GPSET0 ((volatile unsigned int *)(MMIO_BASE + 0x0020001C)) +#define GPSET1 ((volatile unsigned int *)(MMIO_BASE + 0x00200020)) +#define GPCLR0 ((volatile unsigned int *)(MMIO_BASE + 0x00200028)) +#define GPLEV0 ((volatile unsigned int *)(MMIO_BASE + 0x00200034)) +#define GPLEV1 ((volatile unsigned int *)(MMIO_BASE + 0x00200038)) +#define GPEDS0 ((volatile unsigned int *)(MMIO_BASE + 0x00200040)) +#define GPEDS1 ((volatile unsigned int *)(MMIO_BASE + 0x00200044)) +#define GPHEN0 ((volatile unsigned int *)(MMIO_BASE + 0x00200064)) +#define GPHEN1 ((volatile unsigned int *)(MMIO_BASE + 0x00200068)) +#define GPPUD ((volatile unsigned int *)(MMIO_BASE + 0x00200094)) +#define GPPUDCLK0 ((volatile unsigned int *)(MMIO_BASE + 0x00200098)) +#define GPPUDCLK1 ((volatile unsigned int *)(MMIO_BASE + 0x0020009C)) diff --git a/lab2/include/mbox.h b/lab2/include/mbox.h new file mode 100644 index 000000000..ec2bede20 --- /dev/null +++ b/lab2/include/mbox.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +/* a properly aligned buffer */ +extern volatile unsigned int mbox[36]; + +#define MBOX_REQUEST 0 + +/* channels */ +#define MBOX_CH_POWER 0 +#define MBOX_CH_FB 1 +#define MBOX_CH_VUART 2 +#define MBOX_CH_VCHIQ 3 +#define MBOX_CH_LEDS 4 +#define MBOX_CH_BTNS 5 +#define MBOX_CH_TOUCH 6 +#define MBOX_CH_COUNT 7 +#define MBOX_CH_PROP 8 + +/* tags */ +#define TAG_REQUEST_CODE 0x00000000 +#define MBOX_TAG_GETSERIAL 0x10004 +#define MBOX_TAG_GETBOARD 0x00010002 +#define MBOX_TAG_GETARMMEM 0x00010005 +#define MBOX_TAG_LAST 0 + +int mbox_call(unsigned char ch); +void get_board_revision(); +void get_serial_number(); +void get_arm_mem(); diff --git a/lab2/include/memory.h b/lab2/include/memory.h new file mode 100644 index 000000000..458e9bcd1 --- /dev/null +++ b/lab2/include/memory.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#define MEMORY_SIZE 1024 + +static char memory_pool[MEMORY_SIZE]; +static char *memory_ptr = memory_pool; + +void *simple_alloc(size_t size) +{ + void *allocated = memory_ptr; + + if (memory_ptr + size - memory_pool > MEMORY_SIZE) + return NULL; + + memory_ptr += size; + + return allocated; +} diff --git a/lab2/include/reset.h b/lab2/include/reset.h new file mode 100644 index 000000000..a2d8f22bb --- /dev/null +++ b/lab2/include/reset.h @@ -0,0 +1,5 @@ +#pragma once + +void set(long addr, unsigned int value); +void reset(int tick); +void cancel_reset(); diff --git a/lab2/include/shell.h b/lab2/include/shell.h new file mode 100644 index 000000000..32f4288fb --- /dev/null +++ b/lab2/include/shell.h @@ -0,0 +1,5 @@ +#pragma once + +#define MAX_BUFFER_LEN 1024 + +void shell(); diff --git a/lab2/include/string.h b/lab2/include/string.h new file mode 100644 index 000000000..781afa59f --- /dev/null +++ b/lab2/include/string.h @@ -0,0 +1,3 @@ +#pragma once + +int strcmp(const char *s1, const char *s2); diff --git a/lab2/include/uart.h b/lab2/include/uart.h new file mode 100644 index 000000000..99b2be48c --- /dev/null +++ b/lab2/include/uart.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +void uart_init(); +void uart_send(unsigned int c); +char uart_getc(); +void uart_puts(char *s); +void uart_hex(unsigned int d); diff --git a/lab2/initramfs.cpio b/lab2/initramfs.cpio new file mode 100644 index 000000000..3891c6098 Binary files /dev/null and b/lab2/initramfs.cpio differ diff --git a/lab2/kernel/Makefile b/lab2/kernel/Makefile new file mode 100644 index 000000000..07dcf647b --- /dev/null +++ b/lab2/kernel/Makefile @@ -0,0 +1,41 @@ +CC = aarch64-linux-gnu-gcc +LD = aarch64-linux-gnu-ld +AR = aarch64-linux-gnu-ar +OBJCOPY = aarch64-linux-gnu-objcopy +LINKER_SCRIPT = linker.ld +START = start +BUILD = ../build + +CFLAGS := -fno-stack-protector -I ../include/ + +all: $(BUILD)/kernel8.img + +$(BUILD)/$(START).o: $(START).S + $(CC) $(CFLAGS) -c $(START).S -o $(BUILD)/$(START).o + +OBJS := \ + main.o \ + mbox.o \ + uart.o \ + shell.o \ + string.o \ + reset.o \ + cpio.o + +OBJS := $(addprefix $(BUILD)/, $(OBJS)) + +$(BUILD)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILD)/kernel8.img: $(BUILD)/$(START).o $(OBJS) + $(LD) $(BUILD)/$(START).o $(OBJS) -T $(LINKER_SCRIPT) -o $(BUILD)/kernel8.elf + $(OBJCOPY) -O binary $(BUILD)/kernel8.elf $(BUILD)/kernel8.img + +clean: + rm -f $(BUILD)/kernel8.elf $(BUILD)/kernel8.img $(BUILD)/*.o + +run: + qemu-system-aarch64 -M raspi3b -kernel $(BUILD)/kernel8.img -serial null -serial stdio + +run_with_fs: + qemu-system-aarch64 -M raspi3b -kernel $(BUILD)/kernel8.img -serial null -serial stdio -initrd ../initramfs.cpio diff --git a/lab2/kernel/bcm2710-rpi-3-b-plus.dtb b/lab2/kernel/bcm2710-rpi-3-b-plus.dtb new file mode 100644 index 000000000..c83b0817e Binary files /dev/null and b/lab2/kernel/bcm2710-rpi-3-b-plus.dtb differ diff --git a/lab2/kernel/cpio.c b/lab2/kernel/cpio.c new file mode 100644 index 000000000..39e91f281 --- /dev/null +++ b/lab2/kernel/cpio.c @@ -0,0 +1,102 @@ +#include "cpio.h" +#include "string.h" +#include "uart.h" + +static int hex_to_int(char *p, int len) +{ + int val = 0; + int tmp; + + for (int i = 0; i < len; i++) { + tmp = *(p + i); + if (tmp >= 'A') + tmp = tmp - 'A' + 10; + else + tmp -= '0'; + val <<= 4; + val |= tmp; + } + return val; +} + +// For cpio alignment issue: https://stackoverflow.com/questions/59138551/extra-bytes-are-padding-in-the-generated-file-from-cpio + +void cpio_ls() +{ + struct cpio_newc_header *fs = (struct cpio_newc_header *)0x20000000; + char *current = (char *)0x20000000; + + while (1) { + fs = (struct cpio_newc_header *)current; + int name_size = hex_to_int(fs->c_namesize, 8); + int file_size = hex_to_int(fs->c_filesize, 8); + + current += sizeof(*fs); + if (strcmp(current, "TRAILER!!!") == 0) + break; + + uart_puts(current); + uart_puts("\r\n"); + current += name_size; + if ((current - (char *)fs) % 4 != 0) + current += (4 - (current - (char *)fs) % 4); + + current += file_size; + if ((current - (char *)fs) % 4 != 0) + current += (4 - (current - (char *)fs) % 4); + } +} + +void cpio_cat() +{ + char ch; + char filename[1024]; + int idx = 0; + + uart_puts("\r\n"); + uart_puts("filename: "); + while (1) { + ch = uart_getc(); + uart_send(ch); + if (ch == '\n') { + filename[idx] = '\0'; + idx = 0; + break; + } else { + filename[idx] = ch; + idx++; + } + } + + struct cpio_newc_header *fs = (struct cpio_newc_header *)0x20000000; + char *current = (char *)0x20000000; + while (1) { + fs = (struct cpio_newc_header *)current; + int name_size = hex_to_int(fs->c_namesize, 8); + int file_size = hex_to_int(fs->c_filesize, 8); + current += sizeof(*fs); + if (strcmp(current, "TRAILER!!!") == 0) { + uart_puts("\r\n"); + uart_puts(filename); + uart_puts(": No such file.\n"); + break; + } + if (strcmp(current, filename) == 0) { + current += name_size; + if ((current - (char *)fs) % 4 != 0) + current += (4 - (current - (char *)fs) % 4); + // uart_puts(current); + for (int i = 0; i < file_size; i++) + uart_send(current[i]); + uart_puts("\r\n"); + break; + } + current += name_size; + if ((current - (char *)fs) % 4 != 0) + current += (4 - (current - (char *)fs) % 4); + + current += file_size; + if ((current - (char *)fs) % 4 != 0) + current += (4 - (current - (char *)fs) % 4); + } +} diff --git a/lab2/kernel/linker.ld b/lab2/kernel/linker.ld new file mode 100644 index 000000000..1352bfb14 --- /dev/null +++ b/lab2/kernel/linker.ld @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +SECTIONS +{ + . = 0x80000; + .text : { KEEP(*(.text.boot)) *(.text .text.* .gnu.linkonce.t*) } + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r*) } + PROVIDE(_data = .); + .data : { *(.data .data.* .gnu.linkonce.d*) } + .bss (NOLOAD) : { + . = ALIGN(16); + __bss_start = .; + *(.bss .bss.*) + *(COMMON) + __bss_end = .; + } + _end = .; + + /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) } +} +__bss_size = (__bss_end - __bss_start)>>3; diff --git a/lab2/kernel/main.c b/lab2/kernel/main.c new file mode 100644 index 000000000..1d9cf5d91 --- /dev/null +++ b/lab2/kernel/main.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "uart.h" +#include "mbox.h" +#include "shell.h" + +void main() +{ + // set up serial console + uart_init(); + shell(); +} diff --git a/lab2/kernel/mbox.c b/lab2/kernel/mbox.c new file mode 100644 index 000000000..14496db96 --- /dev/null +++ b/lab2/kernel/mbox.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "gpio.h" +#include "mbox.h" + +/* mailbox message buffer */ +volatile unsigned int __attribute__((aligned(16))) mbox[36]; + +#define VIDEOCORE_MBOX (MMIO_BASE + 0x0000B880) +#define MBOX_READ ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x0)) +#define MBOX_POLL ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x10)) +#define MBOX_SENDER ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x14)) +#define MBOX_STATUS ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x18)) +#define MBOX_CONFIG ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x1C)) +#define MBOX_WRITE ((volatile unsigned int *)(VIDEOCORE_MBOX + 0x20)) +#define MBOX_RESPONSE 0x80000000 +#define MBOX_FULL 0x80000000 +#define MBOX_EMPTY 0x40000000 + +/** + * Make a mailbox call. Returns 0 on failure, non-zero on success + */ +int mbox_call(unsigned char ch) +{ + unsigned int r = + (((unsigned int)((unsigned long)&mbox) & ~0xF) | (ch & 0xF)); + /* wait until we can write to the mailbox */ + do { + asm volatile("nop"); + } while (*MBOX_STATUS & MBOX_FULL); + /* write the address of our message to the mailbox with channel identifier */ + *MBOX_WRITE = r; + /* now wait for the response */ + while (1) { + /* is there a response? */ + do { + asm volatile("nop"); + } while (*MBOX_STATUS & MBOX_EMPTY); + /* is it a response to our message? */ + if (r == *MBOX_READ) + /* is it a valid successful response? */ + return mbox[1] == MBOX_RESPONSE; + } + return 0; +} + +void get_board_revision() +{ + mbox[0] = 7 * 4; // buffer size in bytes + mbox[1] = MBOX_REQUEST; + // tags begin + mbox[2] = MBOX_TAG_GETBOARD; // tag identifier + mbox[3] = 4; // maximum of request and response value buffer's length. + mbox[4] = TAG_REQUEST_CODE; + mbox[5] = 0; // value buffer + // tags end + mbox[6] = MBOX_TAG_LAST; +} + +void get_serial_number() +{ + mbox[0] = 8 * 4; // buffer size in bytes + mbox[1] = MBOX_REQUEST; + // tags begin + mbox[2] = MBOX_TAG_GETSERIAL; // tag identifier + mbox[3] = 8; // maximum of request and response value buffer's length. + mbox[4] = 8; + mbox[5] = 0; + mbox[6] = 0; + // tags end + mbox[7] = MBOX_TAG_LAST; +} + +void get_arm_mem() +{ + mbox[0] = 8 * 4; // buffer size in bytes + mbox[1] = MBOX_REQUEST; + // tags begin + mbox[2] = MBOX_TAG_GETARMMEM; // tag identifier + mbox[3] = 8; // maximum of request and response value buffer's length. + mbox[4] = TAG_REQUEST_CODE; + mbox[5] = 0; // value buffer + mbox[6] = 0; // value buffer + // tags end + mbox[7] = MBOX_TAG_LAST; +} diff --git a/lab2/kernel/reset.c b/lab2/kernel/reset.c new file mode 100644 index 000000000..e9104fc95 --- /dev/null +++ b/lab2/kernel/reset.c @@ -0,0 +1,23 @@ +#include "reset.h" + +#define PM_PASSWORD 0x5a000000 +#define PM_RSTC 0x3F10001c +#define PM_WDOG 0x3F100024 + +void set(long addr, unsigned int value) +{ + volatile unsigned int *point = (unsigned int *)addr; + *point = value; +} + +void reset(int tick) +{ // reboot after watchdog timer expire + set(PM_RSTC, PM_PASSWORD | 0x20); // full reset + set(PM_WDOG, PM_PASSWORD | tick); // number of watchdog tick +} + +void cancel_reset() +{ + set(PM_RSTC, PM_PASSWORD | 0); // full reset + set(PM_WDOG, PM_PASSWORD | 0); // number of watchdog tick +} diff --git a/lab2/kernel/shell.c b/lab2/kernel/shell.c new file mode 100644 index 000000000..670fb4189 --- /dev/null +++ b/lab2/kernel/shell.c @@ -0,0 +1,122 @@ +#include + +#include "shell.h" +#include "uart.h" +#include "string.h" +#include "reset.h" +#include "mbox.h" +#include "cpio.h" + +static void dispatch_cmd(const char *cmd) +{ + if (strcmp(cmd, "hello") == 0) { + uart_puts("Hello, world!\r\n"); + return; + } + if (strcmp(cmd, "help") == 0) { + uart_puts("Available commands:\r\n"); + uart_puts(" hello - print a greeting\r\n"); + uart_puts(" help - print this help message\r\n"); + uart_puts(" reboot - reboot the system\r\n"); + uart_puts( + " info - print the board revision, memory base address, memory size, and serial number\r\n"); + uart_puts(" ls - List information about the FILEs\r\n"); + uart_puts(" cat - Concatenate FILE(s)\r\n"); + return; + } + if (strcmp(cmd, "reboot") == 0) { + uart_puts("rebooting...\r\n"); + reset(1000); + do { + asm volatile("nop"); + } while (1); + } + if (strcmp(cmd, "info") == 0) { + get_board_revision(); + if (mbox_call(MBOX_CH_PROP)) { + uart_puts("Revision: "); + uart_puts("0x"); + uart_hex(mbox[5]); + uart_puts("\r\n"); + } else { + uart_puts("Unable to query revision!\n"); + } + get_arm_mem(); + if (mbox_call(MBOX_CH_PROP)) { + uart_puts("Memory base address: "); + uart_puts("0x"); + uart_hex(mbox[5]); + uart_puts("\r\n"); + uart_puts("Memory size: "); + uart_puts("0x"); + uart_hex(mbox[6]); + uart_puts("\r\n"); + } else { + uart_puts("Unable to query memory info!\n"); + } + get_serial_number(); + if (mbox_call(MBOX_CH_PROP)) { + uart_puts("Serial Number: "); + uart_puts("0x"); + uart_hex(mbox[6]); + uart_hex(mbox[5]); + uart_puts("\r\n"); + } else { + uart_puts("Unable to query serial!\n"); + } + return; + } + if (strcmp(cmd, "ls") == 0) { + cpio_ls(); + return; + } + if (strcmp(cmd, "cat") == 0) { + cpio_cat(); + return; + } + + uart_puts("ERROR: Unrecognized command!\r\n"); +} + +void shell() +{ + char buffer[MAX_BUFFER_LEN]; + size_t buffer_index = 0; + char ch; + + // set up serial console + uart_init(); + + // say hello + uart_puts("Starting the shell!\r\n"); + + while (1) { + uart_puts("# "); + buffer_index = 0; + buffer[0] = '\0'; + + while (1) { + ch = uart_getc(); + if (buffer_index + 1 >= sizeof(buffer)) { + uart_puts( + "ERROR: Exceed buffer length limit!\r\n"); + buffer_index = 0; + buffer[0] = '\0'; + break; + } + if (ch == '\n') { + uart_puts("\r\n"); + buffer[buffer_index] = '\0'; + break; + } + uart_send(ch); + buffer[buffer_index++] = ch; + } + dispatch_cmd(buffer); + } + + // echo everything back + while (1) { + uart_send(uart_getc()); + } +} diff --git a/lab2/kernel/start.S b/lab2/kernel/start.S new file mode 100644 index 000000000..53618397f --- /dev/null +++ b/lab2/kernel/start.S @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +.section ".text.boot" + +.global _start + +_start: + // read cpu id, stop slave cores + mrs x1, mpidr_el1 + and x1, x1, #3 + cbz x1, 2f + // cpu id > 0, stop +1: wfe + b 1b +2: // cpu id == 0 + + // set top of stack just before our code (stack grows to a lower address per AAPCS64) + ldr x1, =_start + mov sp, x1 + + // clear bss + ldr x1, =__bss_start + ldr w2, =__bss_size +3: cbz w2, 4f + str xzr, [x1], #8 + sub w2, w2, #1 + cbnz w2, 3b + + // jump to C code, should not return +4: bl main + // for failsafe, halt this core too + b 1b diff --git a/lab2/kernel/string.c b/lab2/kernel/string.c new file mode 100644 index 000000000..227b33fe4 --- /dev/null +++ b/lab2/kernel/string.c @@ -0,0 +1,18 @@ +#include "string.h" + +int strcmp(const char *s1, const char *s2) +{ + char *_s1 = (char *)s1; + char *_s2 = (char *)s2; + while (_s1 && _s2) { + if (*_s1 == '\n' || *_s2 == '\0') + return 0; + if (*_s1 == '\r' || *_s2 == '\0') + return 0; + if (*_s1 != *_s2) + return *_s1 - *_s2; + _s1++; + _s2++; + } + return *_s2 != '\0'; +} diff --git a/lab2/kernel/uart.c b/lab2/kernel/uart.c new file mode 100644 index 000000000..cd5f000f2 --- /dev/null +++ b/lab2/kernel/uart.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2018 bzt (bztsrc@github) + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "gpio.h" + +/* Auxilary mini UART registers */ +#define AUX_ENABLE ((volatile unsigned int *)(MMIO_BASE + 0x00215004)) +#define AUX_MU_IO ((volatile unsigned int *)(MMIO_BASE + 0x00215040)) +#define AUX_MU_IER ((volatile unsigned int *)(MMIO_BASE + 0x00215044)) +#define AUX_MU_IIR ((volatile unsigned int *)(MMIO_BASE + 0x00215048)) +#define AUX_MU_LCR ((volatile unsigned int *)(MMIO_BASE + 0x0021504C)) +#define AUX_MU_MCR ((volatile unsigned int *)(MMIO_BASE + 0x00215050)) +#define AUX_MU_LSR ((volatile unsigned int *)(MMIO_BASE + 0x00215054)) +#define AUX_MU_MSR ((volatile unsigned int *)(MMIO_BASE + 0x00215058)) +#define AUX_MU_SCRATCH ((volatile unsigned int *)(MMIO_BASE + 0x0021505C)) +#define AUX_MU_CNTL ((volatile unsigned int *)(MMIO_BASE + 0x00215060)) +#define AUX_MU_STAT ((volatile unsigned int *)(MMIO_BASE + 0x00215064)) +#define AUX_MU_BAUD ((volatile unsigned int *)(MMIO_BASE + 0x00215068)) + +/** + * Set baud rate and characteristics (115200 8N1) and map to GPIO + */ +void uart_init() +{ + register unsigned int r; + + /* initialize UART */ + *AUX_ENABLE |= 1; // enable UART1, AUX mini uart + *AUX_MU_IER = 0; + *AUX_MU_CNTL = 0; + *AUX_MU_LCR = 3; // 8 bits + *AUX_MU_MCR = 0; + *AUX_MU_IER = 0; + *AUX_MU_IIR = 0xc6; // disable interrupts + *AUX_MU_BAUD = 270; // 115200 baud + /* map UART1 to GPIO pins */ + r = *GPFSEL1; + r &= ~((7 << 12) | (7 << 15)); // gpio14, gpio15 + r |= (2 << 12) | (2 << 15); // alt5 + *GPFSEL1 = r; + *GPPUD = 0; // enable pins 14 and 15 + r = 150; + while (r--) { + asm volatile("nop"); + } + *GPPUDCLK0 = (1 << 14) | (1 << 15); + r = 150; + while (r--) { + asm volatile("nop"); + } + *GPPUDCLK0 = 0; // flush GPIO setup + *AUX_MU_CNTL = 3; // enable Tx, Rx +} + +/** + * Send a character + */ +void uart_send(unsigned int c) +{ + /* wait until we can send */ + do { + asm volatile("nop"); + } while (!(*AUX_MU_LSR & 0x20)); + /* write the character to the buffer */ + *AUX_MU_IO = c; +} + +/** + * Receive a character + */ +char uart_getc() +{ + char r; + /* wait until something is in the buffer */ + do { + asm volatile("nop"); + } while (!(*AUX_MU_LSR & 0x01)); + /* read it and return */ + r = (char)(*AUX_MU_IO); + /* convert carrige return to newline */ + return r == '\r' ? '\n' : r; +} + +/** + * Display a string + */ +void uart_puts(char *s) +{ + while (*s) { + /* convert newline to carrige return + newline */ + if (*s == '\n') + uart_send('\r'); + uart_send(*s++); + } +} + +/** + * Display a binary value in hexadecimal + */ +void uart_hex(unsigned int d) +{ + unsigned int n; + int c; + for (c = 28; c >= 0; c -= 4) { + // get highest tetrad + n = (d >> c) & 0xF; + // 0-9 => '0'-'9', 10-15 => 'A'-'F' + n += n > 9 ? 0x37 : 0x30; + uart_send(n); + } +} diff --git a/lab2/pack_fs.sh b/lab2/pack_fs.sh new file mode 100755 index 000000000..9b0159ea9 --- /dev/null +++ b/lab2/pack_fs.sh @@ -0,0 +1,3 @@ +cd rootfs +find . | cpio -o -H newc > ../initramfs.cpio +cd .. diff --git a/lab2/rootfs/file1.txt b/lab2/rootfs/file1.txt new file mode 100644 index 000000000..5c1170f2e --- /dev/null +++ b/lab2/rootfs/file1.txt @@ -0,0 +1 @@ +This is file 1. diff --git a/lab2/rootfs/file2.txt b/lab2/rootfs/file2.txt new file mode 100644 index 000000000..3eac351c9 --- /dev/null +++ b/lab2/rootfs/file2.txt @@ -0,0 +1 @@ +This is file 2.